[issue37564] ArgumentParser should support bool type according to truth values

Zach Beniash report at bugs.python.org
Thu Jul 11 11:10:32 EDT 2019


New submission from Zach Beniash <zbeniash at gmail.com>:

Today when using argparse.ArgumentParser it seems that the bool type is not supported in a logical way.
Foe example:
-------------------------------------
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--mybool", type=bool)
parsed_args = parser.parse(["--mybool", "False"])
--------------------------------------
parsed_args.my_bool evaluates to True

Instead we should expect to evaluate False here.

----------
components: Library (Lib)
messages: 347686
nosy: Zach Beniash
priority: normal
severity: normal
status: open
title: ArgumentParser should support bool type according to truth values
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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


More information about the Python-bugs-list mailing list