>>> 5/6 0 >>> bool(5/6) False >>> 6/5 1 >>> bool(6/5) True
This is the result of the / operator in Python 2.7, performing integer division, and then converting the result to logical.
If you do from __future__ import division , this will no longer work, because the / operator will perform floating point division rather than integer division.
So the result will be > 0 for x < y and will still evaluate to True.
>>> from __future__ import division >>> 5/6 0.8333333333333334 >>> bool(5/6) True >>> 6/5 1.2 >>> bool(6/5) True
source share