On Tue, Aug 9, 2016 at 9:26 AM Joseph Bane <havocjos...@gmail.com> wrote:
> Hello. > > It recently came to my attention that the strtobool function in the > standard library doesn't return Python native boolean values, but rather > returns integer 0 or 1: > > https://hg.python.org/cpython/file/3.5/Lib/distutils/util.py#l304 > > I am curious why this is the defined behavior and whether anyone can fill > me in regarding this approach. For clarity, I would expect the code to > `return True` and `return False` rather than `return 1` and `return 0`. > I'll take a guess: it's probably a(n) historical artifact. Before there were bools, returning 1 or 0 was the obvious technique. Even after bools were added to Python 2, returning the literal 1 or 0 was faster than looking up the names True or False. Now that True and False are keywords, using the keyword is the obvious solution. -- https://mail.python.org/mailman/listinfo/python-list