[Python-ideas] filter

Daniel Stutzbach daniel at stutzbachenterprises.com
Mon Sep 28 01:23:51 CEST 2009


On Sun, Sep 27, 2009 at 6:20 PM, Josef Eschgfaeller <esg at unife.it> wrote:

> It would be nice to have a syntax like
>
>    [f(x) for x in u and cond(x)]
>

If I understand what you're asking for, Python already supports this.  The
syntax is:

[f(x) for x in u if cond(x)]

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090927/d0a98a0f/attachment.html>


More information about the Python-ideas mailing list