Christoph Zwerschke added the comment: Thanks for the quick explanation. I understand that class scopes don't extend and this is documented behavior.
However, the question is why the if clause is executed in a scope of its own and where this is documented. You would expect that the problematic generator expression is equivalent to the following code which works fine: class A: a = 'test' def __g(a): for c in a: if c in a: yield c tuple(__g(a)) __________________________________ 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