any() and all() on empty list?

Paul Rubin http
Wed Mar 29 00:40:49 EST 2006


"Steve R. Hastings" <steve at hastings.org> writes:
> In the all() example, if there *are* no values in S, then none of the
> values can be != 0, and IMHO all() should return False.

That goes against the usual meaning of "all" in, say, mathematical logic.

Usually, "for all X in S, PRED(x) is true" means:
there does not exist X in S so that PRED(x) is false.

So, all(empty sequence) should be true.  



More information about the Python-list mailing list