Re: List comprehensions and evaluation of elements therein

2015-09-23 Thread Ian Kelly
On Wed, Sep 23, 2015 at 12:12 PM, James Harris wrote: > A list comprehension has various components. Anyone know when each of the > elements is evaluated? In the form > > [v0 for v0 in expr0 if expr1] > > If v0 appears in expr0 or expr1 the evaluation order matters. > > I think of the above as be

List comprehensions and evaluation of elements therein

2015-09-23 Thread James Harris
A list comprehension has various components. Anyone know when each of the elements is evaluated? In the form [v0 for v0 in expr0 if expr1] If v0 appears in expr0 or expr1 the evaluation order matters. I think of the above as being a rewrite of results = [] for v0 in expr0: if expr1: