I'm currently porting some Python2 code to Python3, and I've encountered this little gem:
v = (1, )
if v < 1:
pass
Now, in Python3 it throws an error:
TypeError: '<' not supported between instances of 'tuple' and 'int'.
Which is fine, since you cannot compare tuples and integers. But in Python2 this is allowed:
>>> (1, ) < 1
False
I've googled, but can't find an example of how this comparison works. How/why does the above example evaluate to False
?