[issue18943] argparse: default args in mutually exclusive groups

paul j3 report at bugs.python.org
Wed Dec 6 13:28:18 EST 2017


paul j3 <ajipanca at gmail.com> added the comment:

That's not how flagged (optionals) arguments work.

The default value is used if the flag is not provided at all.  One of your arguments is a 'store_true'.  Its default value if False, which is changed to True if the '--device-get-capabilities' flag is provided.

"nargs='?'" provides a third option, assigning the 'const' value if the flag is used without an argument.

In any case your problem isn't with a required mutually exclusive group (defaults or not).  It has to do with understanding optionals and their defaults.

----------

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


More information about the Python-bugs-list mailing list