On Mon, Aug 23, 2021 at 10:26:47PM -0700, Christopher Barker wrote:
On Mon, Aug 23, 2021 at 6:54 AM Thomas Grainger
wrote: here's another fun one "A False midnight": https://lwn.net/Articles/590299/ https://bugs.python.org/issue13936#msg212771
This is a great example of the problem of the assumption of zero as representing false.
That's not really a problem with zero representing false. Its a problem with representing time of day as a number where midnight is zero :-) *Durations* can be represented satisfactorily as a number (at least I can't think of any problems off the top of my head) but wall times (the number you see when you look at a clock) aren't really *numbers* in any real sense. You can't say "3:15pm times 2 is 6:30pm", 1:00am is not the multiplicative identity element and midnight is not the annihilating element (zero). We conventionally represent clock times as numbers, but they're more akin to ordinal data. They have an order, but you can't do arithmetic on them.
I’ve always been ambivalent about Python’s concept of Truthiness (“something or nothing”). If I were to write my own language, I would probably require a actual Boolean for, eg, an if statement.
"Please sir, can we have some more Pascal" *wink* How about short-circuiting `or` and `and` operators? I'm not judging, just commenting. It surprises me that people who are extremely comfortable with duck-typing pretty much any other data type often draw the line at duck-typing bools.
The fact is that what defines falsiness is use case dependent. Numbers are the best example, zero. A often be a perfectly meaningful number.
Fun fact: not only did the ancient Greek mathematicians not count zero as a number, but the Pythagoreans didn't count 1 as a number either. https://www.britannica.com/topic/number-symbolism/Pythagoreanism Zero is a perfectly meaningful number, but it is special: it is the identity element for addition and subtraction, and the annihilating element for multiplication, and it has no inverse in the Reals. Even in number systems which allow division by zero, you still end up with weird shit like 1/0 = 2/0 = 3/0 ... -- Steve