When trying to compare dictionaries, python raises a TypeError:
{"a" : "b"} < {"a" : "b"} # TypeError
When trying to compare tuples, python does it elementwise:
(1, 2) > (1, 1) # True
Therefore, I expected that comparing tuples containing dictionaries would result in a TypeError if the elements preceding the dictionaries were equal because it would then be forced to compare the dictionaries, which would raise a TypeError. This is not the case:
(3, {"a" : "b"}) < (3, {"a" : "b"}) # False, no TypeError
I've read through the documentation I could find regarding Python sorting and did not see anything documenting this behavior. Can I rely on this behavior staying the same in future versions?