[issue2529] list/generator comprehension parser doesn't match spec

2008-04-02 Thread Nick Guenther
Nick Guenther <[EMAIL PROTECTED]> added the comment: Oh, okay. That's really confusing because I expect "in" to always return a bool, but in the spirit of python there's no reason it should I guess. __ Tracker <[EMAIL PROTECTED]>

[issue2529] list/generator comprehension parser doesn't match spec

2008-04-01 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Indeed; your sample is equivalent to: temp = (j in ['a','b','c'])# the "contains" operator [e for i in temp] # basic list comprehension Even if not meaningful, this code is syntactically correct. -- no

[issue2529] list/generator comprehension parser doesn't match spec

2008-04-01 Thread Robert Lehmann
Robert Lehmann <[EMAIL PROTECTED]> added the comment: Your example is parsed as [e for i in (j in ['a','b','c'])] and since `j` is not defined, you get a NameError. If it was defined, you would still be iterating a boolean (which is not defined). Grammatically, this is the following (just the im

[issue2529] list/generator comprehension parser doesn't match spec

2008-04-01 Thread Nick Guenther
New submission from Nick Guenther <[EMAIL PROTECTED]>: I think I've found a bug in python's list comprehension parser. Observe: >>> [e for i in j in ['a','b','c']] Traceback (most recent call last): File "", line 1, in NameError: name 'j' is not defined Now, according to the grammar at http: