[issue45235] argparse does not preserve namespace with subparser defaults
paul j3
report at bugs.python.org
Mon Oct 25 19:27:59 EDT 2021
paul j3 <ajipanca at gmail.com> added the comment:
parser = argparse.ArgumentParser()
sub = parser.add_subparsers()
example_subparser = sub.add_parser("example")
example_subparser.add_argument("--flag", default=10)
print(parser.parse_args(["example","--flag=15"], argparse.Namespace(flag=20)))
still returns flag=20
User input should override values set by the provided Namespace.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45235>
_______________________________________
More information about the Python-bugs-list
mailing list