[Python-ideas] Allow filter(items)

Serhiy Storchaka storchaka at gmail.com
Wed Aug 7 10:55:17 CEST 2013


07.08.13 11:43, Stephen J. Turnbull написав(ла):
> One of the things I like about Python is that it mostly manages to
> eschew magic values (like "None" meaning "bool") and spurious brevity
> (like defaulting the predicate).  While "bool" may be the most common
> predicate here, it's not obvious to me what the absence of the
> predicate means.  On both counts, I'm against this (or any) default.
>
> Specifically, in most of the applications where I personally would
> want to use something like "filter", zeros and empty lists are typically
> valid values.  So I'd want to filter "None" or similar "not available"
> values.  Therefore I would expect "is not None" to be the default.

The default predicate is not "bool". The default is identity function 
(lambda x: x).




More information about the Python-ideas mailing list