[Python-ideas] Where-statement (Proposal for function expressions)

Jan Kaliszewski zuo at chopin.edu.pl
Thu Jul 16 19:57:55 CEST 2009


> or maybe better:
>
> while foo(x) and bar():
>      where:
>          foo = SOMETHING
>          def bar():
>              SOMETHING ELSE
>      THE
>      LOOP
>      BODY

Another possible variant:

while foo(x) and bar()    # no colon
where:
         foo = SOMETHING
         def bar():
             SOMETHING ELSE
do:
         THE
         LOOP
         BODY

But the former has such an advantage that where-block content is
indented deeper than loop body -- what reflects that it (where-block)
creates nested scope (contrary to loop body).

-- 
Jan Kaliszewski <zuo at chopin.edu.pl>



More information about the Python-ideas mailing list