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 cito
Recipients cito, georg.brandl
Date 2008-03-02.22:27:55
SpamBayes Score 0.0020127732
Marked as misclassified No
Message-id <1204496876.92.0.69876725869.issue2217@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks, this now makes sense to me. You're right, it's rather an ugly
wart than a bug.

But I think the Python reference needs to be improved to make this clear
enough.

How about the following proposed addtions (in square brackets) to
section 5.2.5 (http://docs.python.org/ref/genexpr.html):

"Variables used in the generator expression are evaluated lazily [in the
scope of the generator function] when the next() method is called for
[the] generator object (in the same fashion as normal generators).
However, the leftmost for clause is immediately evaluated [in the
current scope] so that [an] error produced by it can be seen before any
other possible error in the code that handles the generator expression.
Subsequent for [and if] clauses cannot be evaluated immediately since
they may depend on the previous for loop."
History
Date User Action Args
2008-03-02 22:27:57citosetspambayes_score: 0.00201277 -> 0.0020127732
recipients: + cito, georg.brandl
2008-03-02 22:27:56citosetspambayes_score: 0.00201277 -> 0.00201277
messageid: <1204496876.92.0.69876725869.issue2217@psf.upfronthosting.co.za>
2008-03-02 22:27:56citolinkissue2217 messages
2008-03-02 22:27:55citocreate