Why is int(50)<str(5) in python 2.x?
问题 In python 3, int(50)<'2' causes a TypeError , and well it should. In python 2.x, however, int(50)<'2' returns True (this is also the case for other number formats, but int exists in both py2 and py3). My question, then, has several parts: Why does Python 2.x (< 3?) allow this behavior? (And who thought it was a good idea to allow this to begin with???) What does it mean that an int is less than a str ? Is it referring to ord / chr ? Is there some binary format which is less obvious? Is there