On 2016-06-29, Steven D'Aprano <[email protected]> wrote:
> To Nick, having 1+True return 2 is an accident of implementation,
My recollection is that it was not an accident of impliementation. It
was an intentional descision to provide compatibility with many years
worth of programs that were written before there was either a boolean
type or built-in True/False integer values.
Those programs often did this at the top:
True = 1
False = 0
Having True and False evaluate as 1 and 0 in an integer expression
context guaranteed that those programs would to continue to work with
minimal changes.
--
Grant Edwards grant.b.edwards Yow! Life is a POPULARITY
at CONTEST! I'm REFRESHINGLY
gmail.com CANDID!!
--
https://mail.python.org/mailman/listinfo/python-list