For loop comprehensions
Benjamin S Wolf
bswolf at google.com
Fri Feb 11 18:10:52 EST 2011
It occurred to me as I was writing a for loop that I would like to
write it in generator comprehension syntax, eg.
for a in b if c:
rather than using one of the more verbose but allowable syntaxes:
for a in (x for x in b if c):
for a in b:
if not c: continue
Python 3.1 does not support "for comprehensions", and a few cursory
searches of PEPs and this list don't turn up anything. I like the idea
enough to suggest it though I'm unfamiliar with the PEP/feature
request process (PEP 1 pointed me here). What do other people think?
--Ben
More information about the Python-list
mailing list