py.user added the comment:

Tested on argdest.py:

#!/usr/bin/env python3

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('x', action='append')
parser.add_argument('x', action='append_const', const=42, metavar='foo')
parser.add_argument('x', action='append_const', const=43, metavar='bar')
parser.add_argument('-x', action='append_const', const=44)

args = parser.parse_args()
print(args)


Run:

[guest@localhost debug]$ ./argdest.py -h
usage: argdest.py [-h] [-x] x

positional arguments:
  x
  foo
  bar

optional arguments:
  -h, --help  show this help message and exit
  -x
[guest@localhost debug]$ ./argdest.py -x 1 -x
Namespace(x=[44, '1', 42, 43, 44])
[guest@localhost debug]$


LGTM.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24419>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to