Is Python's bool sorting defined?
http://docs.python.org/2/reference/datamodel.html#the-standard-type-hierarchy
Booleans: These represent the truth values False and True. The two objects representing the values False and True are the only Boolean objects. The Boolean type is a subtype of plain integers, and Boolean values behave like the values 0 and 1, respectively, in almost all contexts, the exception being that when converted to a string, the strings "False" or "True" are returned, respectively.
This reads to me that the python language requires False < True
, False == 0
, True == 1
, True != 2
.
The same wording is retained in Python 3 as well.