[issue14392] type=bool doesn't raise error in argparse.Action

Steven Bethard report at bugs.python.org
Sat Jul 21 22:19:40 CEST 2012


Steven Bethard <steven.bethard at gmail.com> added the comment:

I can't find anywhere in the documentation where type=bool, type=unicode or type=long are disallowed. They shouldn't be disallowed. If you want to pass type=bool, argparse should not stop you. And it currently doesn't:

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foo', type=bool)
>>> parser.parse_args([''])
Namespace(foo=False)
>>> parser.parse_args(['x'])
Namespace(foo=True)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14392>
_______________________________________


More information about the Python-bugs-list mailing list