On 8/9/2016 9:22 AM, Joseph Bane 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 am rather sure distutils predates 2.2 and the addition of bool. Much code has been converted from 0/1 to False/True. I don't know if this particular holdover is intentional -- fear of breaking something -- or oversight/inertia.

I searched the tracker for 'strtobool' in component 'distutiles', status "don't care", and there were no hits. (Search is not perfect, though.)


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to