Tom Ritchford
Apr 2, 2023

--

Python has a lost opportunity here with these two functions.

They would be so much better if any((x, y, z)) meant exactly the same as x or y or z andall((x, y, z)) meant the same as x and y and z.

Unfortunately, they do not. any() and all() always return a bool, whereas for example x or y or z returns the first one of x, y, z which is non-falsey.

Just a note that has always bothered me.

--

--

No responses yet