[Python-Dev] PEP 3142: Add a "while" clause to generator expressions

Vitor Bosshard algorias at yahoo.com
Wed Jan 21 16:27:38 CET 2009


----- Mensaje original ----
> De: Gerald Britton <gerald.britton at gmail.com>
> Para: rdmurray at bitdance.com
> CC: python-dev at python.org
> Enviado: miércoles, 21 de enero, 2009 11:38:01
> Asunto: Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions
> 
> FWIW, there are a few historic languages that implement a compound
> for-loop:  Algol 68, PL/I, SAS et al allow constructs that, if
> translated to an equivalent (currently invalid) Python-style syntax
> would look like this"
> 
> for <item> in <iterable> while <predicate>:
>   <suite>
>   
> 
> Some also allow for an "until" keyword.  I'm not suggesting that we
> need to do this in Python; it's just interesting to note that there is
> some precedent for this approach.
> 

Well, you could propose changing the for loop syntax (and by extension comprehensions and generators). It's a much more radical proposal, but it does keep consistency across the board, which is one of the major flaws of the PEP in its current form.

BTW, there is already an "until" keyword in python, it's called "while not" ;)


Vitor


      ¡Todo sobre la Liga Mexicana de fútbol! Estadisticas, resultados, calendario, fotos y más:&lt;
http://espanol.sports.yahoo.com/


More information about the Python-Dev mailing list