any() and all() on empty list?

Ron Adam rrr at ronadam.com
Sat Apr 1 19:42:40 EST 2006


Steve R. Hastings wrote:
> On Sat, 01 Apr 2006 14:35:58 -0300, Felipe Almeida Lessa wrote:
>> Two changes:
>>  - Use "is None".
>>  - Use "try ... except" instead of "in"
> 
> Yes.
> 
> 
>> Maybe you don't like my version, and the gains aren't that much, but
>> please use "is None" instead of "== None".
> 
> Actually, I do like your version.  And I try to always use "is None"
> instead of "== None"; today I made a mistake about it.  Thank you for your
> comments.
> 
> Ideally there should be an official tally() function in some module in
> Python, and then we can just use it and not worry about how to write it. :-)

And it's a good candidate to be written in C as well.

Cheers,
    Ron



More information about the Python-list mailing list