Chaining comparison operators in Python

One of the little known facts about Python that can come handy is a possibility to chain comparison operators like this:

x = 5;
print 3 < x < 10;
print x < 10 < x*10;

or

x == y == z

or even

x is y is z
Posted in Misc Tagged with: , ,