[Python-ideas] Allow filter(items)
João Bernardo
jbvsmo at gmail.com
Mon Aug 5 20:31:38 CEST 2013
-1 There should be only one way and there are lots of ways already. Use a
genexp for readability: (x for x in items if x)
João Bernardo
2013/8/5 Serhiy Storchaka <storchaka at gmail.com>
> 05.08.13 20:32, Markus Unterwaditzer написав(ла):
>
> -0, for reasons already mentioned. While i agree that filter(None, items)
>> is counterintuitive, filter(bool, items) looks very readable to me.
>>
>
> filter(bool, items) is redundant in same sense as `if bool(x)`, `for x in
> iter(items)`, or `"%s" % str(x)`. A result of the predicate is implicitly
> called to boolean.
>
>
>
> ______________________________**_________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/**mailman/listinfo/python-ideas<http://mail.python.org/mailman/listinfo/python-ideas>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130805/5893595d/attachment-0001.html>
More information about the Python-ideas
mailing list