This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients paul.j3, py.user
Date 2015-06-22.17:36:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1434994565.62.0.404657490798.issue24419@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2015-06-22 17:36:05paul.j3setrecipients: + paul.j3, py.user
2015-06-22 17:36:05paul.j3setmessageid: <1434994565.62.0.404657490798.issue24419@psf.upfronthosting.co.za>
2015-06-22 17:36:05paul.j3linkissue24419 messages
2015-06-22 17:36:05paul.j3create