paul j3 added the comment:
To wrap this up, the correct way to specify that 2 or more positionals share a
'dest' is to supply that dest as the first parameter. If the help should have
something else, use the `metavar`.
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('x', action='append_const', const=42, metavar='foo')
parser.add_argument('x', action='append_const', const=43, metavar='bar')
parser.print_help()
args=parser.parse_args([])
print(args)
produces
usage: issue24419.py [-h]
positional arguments:
foo
bar
optional arguments:
-h, --help show this help message and exit
Namespace(x=[42, 43])
(I think this issue can be closed).
----------
_______________________________________
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