Thibault Langlois said:
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
Type "help", "copyright", "credits" or "license" for more information.
What am I missing here ?
You tell us. You supply only half the question, what it does,
without saying what you expected or needed.
I expect you're either confused about comparison chaining or about
what happens when you compare objects of different types.
Doing an ordered comparison between two types is undefined by
default, and not guaranteed to even give the same result between
builds. So the following may give different results on your
2.7.4 than on mine.
5 < "abc"
Python 3 fixes that by throwing an exception. TypeError:
unorderable types
This should solve it, since the first and third expression would
seem to be undefined. Unfortunately there's yet another wrinkle.
For hysterical reasons, True and False are instances of class
bool, which is derived from int. So for comparison purposes
False==0 and True==1. But in my opinion, you should never take
advantage of this, except when entering obfuscation
contests.