[Tutor] Syntax for list comps
ben+python at benfinney.id.au
Thu Feb 4 00:31:03 EST 2016
Johan Martinez <jmartiee at gmail.com> writes:
> Where can I find syntax for list comps?
The same place as other syntax descriptions: in the language reference
> I am confused how/whether they are evaluated left-right or right-left.
According to the documentation:
[…] the elements of the new container are those that would be
produced by considering each of the for or if clauses a block,
nesting from left to right, and evaluating the expression to produce
an element each time the innermost block is reached.
> That's a bit confusing syntax for me. Sorry if I am not clear in
> explaining it.
Does that help? If not, please try re-phrasing the question.
\ “The lift is being fixed for the day. During that time we |
`\ regret that you will be unbearable.” —hotel, Bucharest |
More information about the Tutor