Efficiently search two-tuple
python, tuples
Solution
labels = dict(choices)
label = labels[some_int]
you could, of course, join this into an one-liner, if you don't need `labels` anywhere else.
Problem
What's the best one-liner replacement for the code below? I'm sure there's a smarter way. ``` choices = ((1, 'ONE'), (2, 'TWO'), (3, 'THREE')) some_int = 2 for choice in choices: if choice[0] == some_int: label = choice[1] break; # label == 'TWO' ```