KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to combine a string along with a list of strings into a tuple so I can use it as a dictionary key. This is going to be in an inner loop so speed is important. The list will be small (usually 1, but occasionally 2 or 3 items). What is the fastest way to do this? Before: my_string == "foo" my_list == ["bar", "baz", "qux", "etc"] After: my_tuple == ("foo", "bar", "baz", "qux", "etc") (Note: my_list must not be altered itself).
Tags (comma-separated)
Save Edits
Cancel