[Python-ideas] filter-only list comps

Fred Drake fdrake at acm.org
Fri Feb 26 00:35:17 CET 2010


On Thu, Feb 25, 2010 at 6:40 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>  [x from numbers if x%2==1]

I like this, but it has the same readability issue I noted for cases
where decomposition is used:

    [(k, v) from somedict.items() if condition(v)]


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
"Chaos is the score upon which reality is written." --Henry Miller



More information about the Python-ideas mailing list