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 "<stdin>", line 1, in <module> NameError: name 'j' is not defined Now, according to the grammar at http://docs.python.org/ref/lists.html, a list comprehension is (condensed for clarity): list_comprehension ::= expression list_for list_for ::= "for" target_list "in" old_expression_list [list_for] So a list comprehension should always be [.... for ... in .... for ... in ... for ... in ...] (that is, alternating 'for's and 'in's) but here I have a test case that python happily tries to run that looks like [... for ... in ... in ....] ---------- components: Interpreter Core messages: 64818 nosy: kousu severity: normal status: open title: list/generator comprehension parser doesn't match spec type: behavior versions: Python 2.5 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2529> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com