paul j3 added the comment:
You can give the positional any custom name (the first parameter). You just
can't reuse it (by giving 2 positionals the same name). And if you don't like
what the 'help' shows, you can set the 'metavar'. That way only you see the
positional's name.
The name of a positional can be the 'dest' of an optional. But wouldn't that
be confusing? Setting the same attribute with a required postional and one or
more optional optionals?
'nargs' is another way of assigning more than one value to a Namespace
attribute. You just can't put an optional between two such values.
`argparse` is a parser, a way of identifying what the user gives you. It is
better to err on the side of preserving information. Different argument dests
does that. You can always combine values after parsing.
args.foo.append(args.bar) # or .extend()
args.x = [args.foo, args.bar]
Don't try to force argparse to do something special when you can just as easily
do that later with normal Python expressions.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24419>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com