[Python-Dev] PEP 340 keyword: Extended while syntax

Gustavo Niemeyer gustavo at niemeyer.net
Thu May 5 19:36:52 CEST 2005


Greetings,

> Reasoning: The block statement resembles a "while" block in some ways in 
> that it is a conditional block that may be executed only once, or 
> possibly not at all (or many times).  And the word "while" is also 
> descriptive of how a block is used.
> 
>      while VAR1 from EXPR1():
>          BLOCK

This is an interesting propose, but for a different PEP.  In the
current propose VAR1 is not evaluated for truthness, and many of
the usage examples doesn't even require it.

This looks quite strange, for instance:

   while dummy from locking(myLock):
      # Do something

And also, this would require a break necessarily:

   while (foo, bar) from locking():
      # Pass

> This will require a new keyword/operator 'from' to use in a 'from' 
> expression:

'from' is already a keyword, btw.

-- 
Gustavo Niemeyer
http://niemeyer.net


More information about the Python-Dev mailing list