3 ms·
my pragmatic view is that it should be false. A common error would be a programming mistake in the selection of the list element return an empty list. The retu
by neves 3y ago
my pragmatic view is that it should be false.
A common error would be a programming mistake in the selection of the list element return an empty list. The returned list would, unexpectedly, comes empty. Trying to check if everything is black would return True and the code would follow on. It would be very hard to debug
- Akronymus 3y agoFor the any predicate, you want to know if any element satisfies it, which of course, without any elements it can't be satisfied. If you want the inverse behaviour, you have to verify that all elements do not satisfy it. And that necessarily results in the empty set being falsy on any, but truthy on all. Also, its just easier to use .any to check if the set is empty or not, in many cases.