# any() and all() on empty list?

Steven D'Aprano steve at REMOVEMEcyber.com.au
Thu Mar 30 11:53:41 CEST 2006

```Paul Rubin wrote:

> Steven D'Aprano <steve at REMOVEMEcyber.com.au> writes:
>
>>Think of it this way: if all(seq) is true, shouldn't it be the case
>>that you can point to a specific element in seq that is true?
>
>
> No, all(seq) is true if you can't point to a specific element in seq
> that's false.

No, all(seq) is true if every element in seq is true.
Surely that's a more intuitive definition than your
definition by what you can't do.

The question that needs to be answered is, what if
there are no elements at all? That's an arbitrary
decision. Like the question "what is 0**0?" in
mathematics, some answers are more useful than others.
I can respect that practical answer -- but it isn't the

(For those who don't see why 0**0 is problematic, 0**x
is equal to 0 for all x, and x**0 is equal to 1 for all
x, so what do you do for 0**0?)

Here's another way of looking at the problem:

all(flying elephants which are pink) => true
all(flying elephants which are not pink) => true

So, these flying elephants -- are they pink or not?

--
Steven.

```