[ x for x in xrange(10) when p(x) ]
bonono at gmail.com
bonono at gmail.com
Thu Nov 10 06:25:52 EST 2005
I use "list" in the name in "english"/general sense(say a list in
haskell is lazily evaluated), it could be a list or it could be a
lazily evaluated iterable.
The original post is really just about "when" or may be "until" syntax
that makes it a bit shorter to read and hopefuly easier to understand.
Leif K-Brooks wrote:
> Wrapping a function in a generator expression doesn't magically make it
> lazily evaluated. The whole list has to be generated and returned;
> using a generator expression instead of a list comprehension just means
> that it doesn't need to be copied in memory.
More information about the Python-list
mailing list