On 9/29/2010 5:53 AM Philip Semanchuk said...
Does Python make any guarantee that int(True) == 1 and int(False) == 0 will
always hold, or are their values an implementation detail?
I had exactly this same question occur to me yesterday, and yes, I
believe it does. From
http://docs.python.org/reference/datamodel.html#objects-values-and-types
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.
Emile
--
http://mail.python.org/mailman/listinfo/python-list