4 ms·
Good stuff. I was playing around with ordinality of language built-ins recently and found unintuitive results for Python (https://github.com/rflynn/wat/blob/mas
by rflynn 14y ago
Good stuff. I was playing around with ordinality of language built-ins recently and found unintuitive results for Python (https://github.com/rflynn/wat/blob/master/src/py.ord.png https://github.com/rflynn/wat/blob/master/src/py.ord.png). As your article mentions there is a fine line between language and implementation detail.
>>> u"" > () > "" == u""
True
- j_baker 14y agohttp://docs.python.org/library/stdtypes.html#comparisons http://docs.python.org/library/stdtypes.html#comparisons CPython implementation detail: Objects of different types except numbers are ordered by their type names; objects of the same types that don’t support proper comparison are ordered by their address.
- moreati 14y agoWorth mentioning that this was fixed/removed in Python 3.x >>> "" > () Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: str() > tuple()