Question regarding stdlib distutils strtobool behavior

Lutz Horn lutz.horn at posteo.de
Tue Aug 9 09:37:48 EDT 2016


Am 08/09/2016 um 03:22 PM schrieb Joseph Bane:
> 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:

In boolean context, 1 is True and 0 is False. So you should be able to 
use the result without problems.

Why the implementors of Python wrote strtobool this way is something I 
don't know.

Lutz



More information about the Python-list mailing list