[Python-Dev] PEP-xxx: Unification of for statement and list-comp syntax

Heiko Wundram me+python-dev at modelnine.org
Mon May 22 06:57:58 CEST 2006


Am Montag 22 Mai 2006 02:22 schrieb Greg Ewing:
> Heiko Wundram wrote:
> >       for node in tree:
> >           if not node.haschildren():
> >               continue
> >           <do something with node>
>
> Er, you do realise that can be written more straightforwardly as
>
>    for node in tree:
>      if node.haschildren():
>        <do something with node>

Yes, of course. Read my replies to Terry J. Reed, to Josiah Carlton, to Talin, 
to see why I chose to compare it to the 'continue' syntax.

--- Heiko.


More information about the Python-Dev mailing list