3 ms·
> Find an equivalently surprising example in... Let's use the other poster's choice, python. > I'll wait. I don't write Python, but even so it took about 30 s
by carussell 9y ago
> Find an equivalently surprising example in... Let's use the other poster's choice, python.
> I'll wait.
I don't write Python, but even so it took about 30 seconds, using the same area of the linked article as a starting point:
>>> 0 > None
True
At this point, I fully expect some attempt at a post-hoc rationalization for why Python's choice here is unimpeachable.
- AlphaSite 9y agoIs this python 2 or python 3, afaik that was fixed in python 3.
- sdeframond 9y agoThis error has been fixed in Python 3.
- zzalpha 9y agoNope, that's pretty ridiculous!
- apenwarr 9y agopython 2 made a rational, well-considered choice, though I do like the python 3 replacement better. Despite its self-consistency, python 2 ended up causing hard-to-find errors (mostly when people accidentally compared "0" with 0 though; it mostly wasn't a problem with None). In python 2, cross-type comparisons are strictly ordered. So: >>> None == 0 False >>> None < 0 True >>> None <= 0 True >>> None > 0 False Completely consistent, no special cases, and if you sort() a list containing multiple types, it'll always come out in an unsurprising, consistent order.