any() and all() on empty list?

Steve R. Hastings steve at hastings.org
Sat Apr 1 19:19:07 EST 2006


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. :-)
-- 
Steve R. Hastings    "Vita est"
steve at hastings.org    http://www.blarg.net/~steveha




More information about the Python-list mailing list