3 ms·
Why all([]) is true, prod([]) is 1, etc.
- coldtea 3y agoIt's is like saying "only blonde people should be in this room". If there's nobody in the room, it still holds. Replace room with [], and "blonde people" with "X matching C condition" and you get: "only X matching C condition should be in this set" which expresses all([]). It only looks strange for people who somehow misunderstand all([]) to mean: "there must be at least one X in the set" && "only X matching C condition should be in the set". P.S. Nominally all(...) just checks for a single condition: X is True, but it's trivial to get a list of True/False values from any list of other values via mapping it through a boolean function.