[issue44748] argparse: a bool indicating if arg was encountered

Thermi report at bugs.python.org
Thu Sep 2 19:39:52 EDT 2021


Thermi <noel.kuntze+bugs-python-org at thermi.consulting> added the comment:

1) True. That'd mean such functionality would not be usable by such a workaround though.

2) ANY setting has a default value. The output in the --help message has to, if any defaults at all are shown, be the same as the actual default values. Storing the default values as part of the argparse.ArgumentParser configuration prevents duplication of the default value declaration in the config file reader, and the argument parser.

What I request is the reverse of what you wrote. I want the order of priority to fall back to the defaults, if no value is specified in the config file. And if an argument is passed via argv, then that value should take precedence over what is set in the config file. This is in the first message in this issue.

3) Two different places to touch when you want to add a new option:
    1) Default config declared in program code
    2) argparse.ArgumentParser configuration in code.

----------

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


More information about the Python-bugs-list mailing list