4 ms·
The reason it's like this on python has nothing to do with philosophy and everything to do with algebra. The mathematical terminology sadly escapes me but essen
by globular-toast 7y ago
The reason it's like this on python has nothing to do with philosophy and everything to do with algebra. The mathematical terminology sadly escapes me but essentially for each operation you want there to be a value such that application is a no-op. For addition this is 0, for multiplication 1, for and it is True and for or it is False. You want the n-ary versions of the operations to return those values for the 0 arity case. So sum([]) = 0, all([]) = True and if there was one product([]) = 1. This makes the mathematics very uniform and beautiful.
Lispers know this implicitly. You know they say learning Lisp makes you a better programmer? This is an example of that. Raymond Hettinger and many of the Python authors are Lispers are heart and this is obvious to them.
- umanwizard 7y agoThe identity element is the term you’re looking for
- globular-toast 7y agoYeah. Multiplicative identity, additive identity etc. Not sure what the name of the "andity" identity would be. Maybe just "identity of the and operation".
- umanwizard 7y agoLogical "and" is also called "conjunction", so you would call it the "conjunctive identity". "False" would be the "disjunctive identity".