Asked • 04/07/19

Reason for "all" and "any" result on empty lists?

In Python, the built-in functions [`all`](http://docs.python.org/library/functions.html#all) and [`any`](http://docs.python.org/library/functions.html#any) return `True` and `False` respectively for empty iterables. I realise that if it were the other way around, this question could still be asked. But I'd like to know why *that specific* behaviour was chosen. Was it arbitrary, ie. could it just as easily have been the other way, or is there an underlying reason? (The reason I ask is simply because I never remember which is which, and if I knew the rationale behind it then I might. Also, curiosity.)

1 Expert Answer

By:

Max B. answered • 04/06/23

Tutor
0 (0)

University lecturer & senior engineer tutoring Python, other languages

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.