[issue36358] bool type does not support True or False as command line argv

Serhiy Storchaka report at bugs.python.org
Tue Mar 19 03:40:39 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Yes, this is expected. bool('False') is True.

You can write your own converter which returns True for 'True', False for 'False' and raise an exception otherwise.

But it is more common to add a pair of options without arguments --foo/--no-foo, or --with-foo/--without-foo, or --enable-foo/--disable-foo using the "store_const" action with True/False value.

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36358>
_______________________________________


More information about the Python-bugs-list mailing list