This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients docs@python, r.david.murray, uglemat
Date 2013-08-01.12:37:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375360642.97.0.509501336354.issue18612@psf.upfronthosting.co.za>
In-reply-to
Content
Well, you haven't done anything wrong, but I'm not sure what we can do in response to the report.  What how will the answer to the question serve you?  What will you know after getting the answer that you didn't know before getting the answer?  I'm trying here to understand what it is that is missing from your mental model of Python that needs to be filled in, because the syntax and behavior of these constructs is documented, and it has never occurred to me to wonder whether or not a generator expression "is" a comprehension or not.

I'm making things up here, but I suspect we call generator expressions that because while they share the base syntax and much of the same semantics as the things we call comprehensions, (a) they produce an iterable (a generator object) instead instead of a fully realized object and (b) you can specify a generator expression without explicit surrounding punctuation (eg: "myfunc(x for x in range(7))").  That is, the 'comprehensions' are conceptually a notation for "specifying" a collection object using a compact notation, while a generator expression is a way of "creating" a generator-iterable *function* that must then be iterated to produce the collection object implicitly specified by the expression.  I'm not sure I'm being clear, because the distinction is subtle and perhaps not meaningful...the difference in naming might just be an historical accident :)

And, because it is not entirely clear, I'm not sure it is a good idea to try to document it.  Again, what enlightenment would derive from a clear explanation?
History
Date User Action Args
2013-08-01 12:37:23r.david.murraysetrecipients: + r.david.murray, docs@python, uglemat
2013-08-01 12:37:22r.david.murraysetmessageid: <1375360642.97.0.509501336354.issue18612@psf.upfronthosting.co.za>
2013-08-01 12:37:22r.david.murraylinkissue18612 messages
2013-08-01 12:37:22r.david.murraycreate