[Python-ideas] More power in list comprehensions with the 'as' keyword

Tarek Ziadé ziade.tarek at gmail.com
Wed Aug 27 19:41:17 CEST 2008

On Wed, Aug 27, 2008 at 7:30 PM, Bruce Leban <bruce at leapyear.org> wrote:

> [t for t in [t.strip() for t in text.split('\n')] if t != '']

Yes, and other ways could be found with imap/map, but I would find this
simpler and more natural :

[t.strip() as s for t in text.split('\n') if s != '']

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20080827/e0108aea/attachment.html>

More information about the Python-ideas mailing list