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'
you could, of course, join this into an one-liner, if you don’t need
labelsanywhere else.