[Python-ideas] replace boolean methods on builtin types with properties [py4k?]

Steven D'Aprano steve at pearwood.info
Tue Dec 14 12:16:27 CET 2010


Carl M. Johnson wrote:
> On Mon, Dec 13, 2010 at 1:57 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> 
>> Making it more difficult and error prone and slower to do things like:
>>
>> if all(str.isdigit, list_of_strings):
>>    ...
>>
>> or similar.
> 
> Technical note: all only takes an iterable. Its signature is not like
> map's. The correct way to write that is if all(s.isdigit() for s in
> list_of_strings) (minus the calling parentheses if this proposal were
> accepted).

Oops! Of course you're right. This is what happens when you test the 
concept with filter, then change it at the last second to something that 
would be more commonly used than filter :(



-- 
Steven




More information about the Python-ideas mailing list