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

Thermi report at bugs.python.org
Tue Jul 27 05:26:32 EDT 2021


New submission from Thermi <noel.kuntze+bugs-python-org at thermi.consulting>:

It'd be great if as part of the namespace returned by argparse.ArgumentParser.parse_args(), there was a bool indicating if a specific argument was encountered.

That could then be used to implement the following behaviour:
With a config file loaded as part of the program, overwrite the values loaded from the config file if the argument was encountered in the argument vector.

That's necessary to implement overwriting of settings that were previously set by a different mechanism, e.g. read from a config file.

After all the following order of significance should be used:
program defaults < config file < argument vector

----------
components: Library (Lib)
messages: 398288
nosy: Thermi
priority: normal
severity: normal
status: open
title: argparse: a bool indicating if arg was encountered
type: enhancement
versions: Python 3.11

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


More information about the Python-bugs-list mailing list