Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: