I faced a strange behavior with generator expression, which seems like a bug, for both python 2.4 and 2.5 :
>>> class A : ... a = 1, 2, 3 ... b = 1, 2, 3 ... C = list((e,f) for e in a for f in b) ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 4, in A File "<stdin>", line 4, in <genexpr> NameError: global name 'b' is not defined >>> class A : ... a = 1, 2, 3 ... b = 1, 2, 3 ... C = [ (e,f) for e in a for f in b ] ... >>> A.C [(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)] Any comment ? I'm ready to report it as a bug if there is no objection. -- http://mail.python.org/mailman/listinfo/python-list