[docs] [issue18612] More elaborate documentation on how list comprehensions and generator expressions relate to each other

uglemat report at bugs.python.org
Thu Aug 1 15:00:44 CEST 2013

uglemat added the comment:

Yeah I think the differences are pretty easy to comprehend. To be honest the reason I came here is that I had an argument where someone commented on my code (where I used a generator expression) saying something akin to "list comprehensions are nice", so I replied "actually, that's a generator expression, which are very similar but behave differently". The response was that the two concepts are one and the same. I couldn't really say that that's incorrect, but I think it's very confusing for beginners if people are talking about generator expressions like they are list expressions because they behave so differently and the documentation for list comprehensions doesn't mention generator expressions. I was kind of longing for a definite answer so I could say "Nay, thou shall differentiate between list comprehensions and generator expressions". Is it right to correct someone and say that generator expressions are in fact *not* generator expressions? Maybe I'm blowing this out of proportions. :)

versions: +Python 3.5 -Python 2.7, Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the docs mailing list