[docs] [issue18612] More elaborate documentation on how list comprehensions and generator expressions relate to each other
R. David Murray
report at bugs.python.org
Thu Aug 1 15:20:28 CEST 2013
R. David Murray added the comment:
Well, it is the case that if you substitute a list comprehension for a generator expression in arbitrary code, most of the time it would work but occasionally it wouldn't, because the runtime behavior is different (lazy production versus all-at-once production). So yes, the two are not the same thing, and it is important to understand the differences in behavior between them. Calling a generator expression a list comprehension indicates someone's mental model of how Python works has a couple holes in it, IMO :)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18612>
_______________________________________
More information about the docs
mailing list