I try (in Python 2.7.6):
() > '' > [] > {} > 0 > None
And it returns
True
Why is it so?
That is an accident of history.
It is fixed in Python 3:
>>> () > '' > [] > {} > 0 > None
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: tuple() > str()
Or in other words, an ordering was decided upon but there is no particular logical / technical reason why they should order that way and not in a different way. To avoid confusion the types can no longer be compared in that manner in Python 3.
In the Python 2 documentation I could only find:
Objects of different types, except different numeric types and different string types, never compare equal; such objects are ordered consistently but arbitrarily (so that sorting a heterogeneous array yields a consistent result).