2 ms·
> True being coercible to a number is unfortunate If we want to be really pedantic, in Python 2.X, True isn't coercible to an integer, it is an integer. >>> T
by ForHackernews 12y ago
> True being coercible to a number is unfortunate
If we want to be really pedantic, in Python 2.X, True isn't coercible to an integer, it is an integer.
>>> True == 1
True
>>> isinstance(True, int)
True
This is an artifact of the fact that when Python was first created, it didn't have boolean types, so when they were added later, "True" and "False" were bolted on as aliases to the integers 1 and 0.