A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-May/065095.html below:

Unification of for statement and list-compsyntax

[Python-Dev] PEP-xxx: Unification of for statement and list-compsyntax [Python-Dev] PEP-xxx: Unification of for statement and list-compsyntaxTerry Reedy tjreedy at udel.edu
Sun May 21 20:31:11 CEST 2006
"Heiko Wundram" <me+python-dev at modelnine.org> wrote in message 
news:200605211710.51720.me+python-dev at modelnine.org...
>    As I've noticed that I find myself typing the latter quite often
>    in code I write, it would only be sensible to add the corresponding
>    syntax for the for statement:
>
>      for node in tree if node.haschildren():
>          <do something with node>
>
>    as syntactic sugar for:
>
>      for node in tree:
>          if not node.haschildren():
>              continue
>          <do something with node>

Isn't this the same as

      for node in tree:
          if  node.haschildren():
              <do something with node>

so that all you would save is ':\n' and the extra indents?

tjr




More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4