Python is strongly typed; such a table is not required, except between the basic numeric types and the basic types of strings. For numeric types, they are forcibly bound to long (in 2.x) or float as needed. For string types, everything is not so simple and therefore unicode (in 2.x) should be used where possible.
>>> 3 > 2.4 True >>> 'a' < u'あ' True >>> u'a' < 'あ' Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
Comparing between incompatible types in 2.x will not work as you expect.
>>> 2 < '3' True >>> 3 < '2' True
Comparison between incompatible types in 3.x will fail.
3>> 2 < '3' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: int() < str()
source share