Christoph Zwerschke added the comment: 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." __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2217> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com