Python Tuple Comparison Odd Behavior
Can someone please explain this behavior? In[11]: (1, 2) in [(True, 2)] Out[11]: True In[12]: (1, 2) in [(True, True)] Out[12]: False In[13]: (1, 2) in [(True, False)] Out[13]: F
Solution 1:
It's something of an implementation detail of True
, see Is False == 0 and True == 1 in Python an implementation detail or is it guaranteed by the language? for a discussion.
Post a Comment for "Python Tuple Comparison Odd Behavior"