any() and all() on empty list?

Carl Banks invalidemail at aerojockey.com
Thu Mar 30 04:36:41 EST 2006


Steven D'Aprano wrote:
> 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?

Then every element in seq is true.

(And false. :)


Carl Banks




More information about the Python-list mailing list