[Python-ideas] Map-then-filter in comprehensions

João Bernardo jbvsmo at gmail.com
Fri Mar 11 07:42:13 EST 2016


On Thu, Mar 10, 2016 at 7:20 PM, Michał Żukowski <thektulu.pp at gmail.com>
wrote:

> Some time ago I was trying to solve the same issue but using a new keyword
> "where", and I thought that new keyword is too much for just list
> comprehension filtering, so I've made it something like assignments in
> expresion, eg.
>
> (x+y)**2 + (x-y)**2 where x=1, y=2
>
> So for list comprehension I can write:
>
> [stripped for line in lines if stripped where stripped=line.strip()]
>


Why are we not funding this?
But seriously, why? This is great.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160311/79c3d8ae/attachment.html>


More information about the Python-ideas mailing list