Check out some of the (not so weird) Python behaviors on Bool and Int
>>> 1 == True True >>> 0 == False True >>> True*5 == 0 False >>> True*5 == 5 True >>>
How interchangeable they can be used ...!
From boolobject.h (win py 2.7), I see a typedef for bool obj. So it's pretty obvious that bool inherited several int facial features.
#ifndef Py_BOOLOBJECT_H #define Py_BOOLOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef PyIntObject PyBoolObject;
source share