Different behaviour in list comps and generator expressions
ethan at stoneleaf.us
Tue Nov 18 03:20:00 CET 2014
On 11/17/2014 03:38 PM, Dan Stromberg wrote:
> I'm inclined to say that list comprehensions and generator expressions
> should be different. I don't really think they should be identical,
> one being eager and one being lazy. Why let the implementation detail
> of one impact the other?
It's not the eagerness vs. laziness that's being changed, but rather what happens in a generator when something inside
the generator raises StopIteration (as opposed to the generator itself simply return'ing and thereby causing a
StopIteration to be generated).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: OpenPGP digital signature
More information about the Python-list