[Python-Dev] comprehension abbreviation (was: Adding any() and all()) (original) (raw)
Jim Jewett jimjjewett at gmail.com
Fri Mar 11 20:03:17 CET 2005
- Previous message: [Python-Dev] Re: RELEASED Python 2.4.1, release candidate 1
- Next message: [Python-Dev] comprehension abbreviation (was: Adding any() and all())
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Barry:
Ping's suggested list comprehension abbreviation, i.e.:
[x in seq if x] == [x for x in seq if x]
might help.
Note that the last x shouldn't have to be x.
[x in seq if f(x)] is by far my most common syntax error, and
[x for x in seq if f(x)]is always what I want instead.
- Previous message: [Python-Dev] Re: RELEASED Python 2.4.1, release candidate 1
- Next message: [Python-Dev] comprehension abbreviation (was: Adding any() and all())
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]