[Python-ideas] Allow filter(items)
Shane Green
shane at umbrellacode.com
Wed Aug 7 11:11:02 CEST 2013
You ever want to add an efficient ident() to __builtins__ so you could stop using lambda and normalize a bunch of things?
On Aug 7, 2013, at 1:55 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 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).
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130807/d5372079/attachment.html>
More information about the Python-ideas
mailing list