8 ms·
> Surely if 'all' is True then 'any' got to be too? No. `any([])` means "some element of [] is true", which is false because there aren't any elements. `all(
by JadeNB 3y ago
> Surely if 'all' is True then 'any' got to be too?
No. `any([])` means "some element of [] is true", which is false because there aren't any elements. `all([])` means "all elements of [] are true", which is true because it's (classically, anyway) got to be true or false, and being false would require that there be some element of [] that isn't true, which there isn't.
More generally, `!all([!x for x in xs])` (or whatever the syntax is; I'm not a Python programmer)—meaning "it's not the case that the negation of every element of xs is true"—is `any(xs)`, so `!all([])` is `any([])`.