Question regarding stdlib distutils strtobool behavior

Joseph Bane havocjoseph at gmail.com
Tue Aug 9 09:22:06 EDT 2016


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

Thanks,
Joe



More information about the Python-list mailing list