[issue9694] argparse required arguments displayed under "optional arguments"

Krzysiek report at bugs.python.org
Mon Jul 20 06:23:49 EDT 2020


Krzysiek <krzychdid at interia.pl> added the comment:

It seems the discussion has so far revolved around 'optional' arguments with `required=True`.

What about the other way around?

While trying to set `required=False` for a positional argument raises an exception, it is still possible to make the positional argument effectively optional by `nargs='?'` (it is then printed in brackets in usage message).

----------
nosy: +kkarbowiak

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


More information about the Python-bugs-list mailing list