Explain this double speak(>:

[pair for pair in values if key == pair[0]]

 

I understand the 'for pair in values'. I assume the first 'pair' creates the
namespace (although I am not sure how Python knows it's a tuple yet). I
think the outer [] make the line a comprehension ( If so, I don't seem to
get how/why a comprehension works), and probably make the line either a
tuple or list. The comprehension seems to act as a subroutine or macro( yes
I know those two words are meaningless in Python). I definitely am missing
the full meaning of the if statement. The example comes courtesy of Alan.

 

Thanks,

 

Clayton

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to