3 ms·
python 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
by apenwarr 9y ago
python 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.