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

Heiko Wundram me+python-dev at modelnine.org
Mon May 22 07:01:33 CEST 2006


Am Montag 22 Mai 2006 02:46 schrieben Sie:

Heiko Wundram wrote: > 2) Just as I've replied to Terry J. Reed, if you find list comprehensions > easy to read, you're also bound to be able to understand what "for > in if :" does, at least AFAICT.

I tend to write non-trivial LCs on multiple lines, e.g. l = [foo(x) for x in stuff if somethingabout(x)] for the very reason that it makes them easier to read.

You can also do the same here (by using normal bracketing):

for in ( ) if ( and and ): foo(x)

--- Heiko.



More information about the Python-Dev mailing list