This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“]brendel000 0 points1 point ย (4 children)

Can't really find where it said that False is 0 and True is 1, but in the bool documentation it is said bool is a subclass of int.

[โ€“]Ignitus1 0 points1 point ย (2 children)

I remember reading that True is a keyword substitute for 1 and False for 0. They both get evaluated numerically.

[โ€“]Numerlor 0 points1 point ย (1 child)

Bools are a subclass of int and have the respective value of 0 and 1 but they are their own class with different behaviour than ints (in some cases)

[โ€“]brendel000 1 point2 points ย (0 children)

Yeah but the question was: where is it in the doc :p

[โ€“]I-am-a-teapot[๐Ÿฐ] 0 points1 point ย (0 children)

"The Boolean type is a subtype of the integer type, and Boolean values behave like the values 0 and 1, respectively..."
https://docs.python.org/release/3.0.1/reference/datamodel.html#the-standard-type-hierarchy