a potential pep to extend the syntax of for loops
gagsl-py2 at yahoo.com.ar
Mon Mar 9 16:35:17 CET 2009
En Mon, 09 Mar 2009 07:15:30 -0200, pang <pablo.angulo at uam.es> escribió:
> This is an idea about something I'd like to see implemented in
The python-ideas list exists to discuss this sort of things.
> The syntax of a for loop is restricted to the following:
>>>> for element in list:
Note that "list" in your description may be any expression list, in
particular a conditional expression. This is currently valid:
for e in iterable1 if cond else iterable2:
In your proposal, depending whether there is an "else" clause or not, the
"if" should be attached to the expression or the for statement. I'm unsure
if this still can be represented as an LL(1) grammar (and Guido always
said he wants the grammar to stay LL(1)).
More information about the Python-list