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-18.17:01:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1434646911.84.0.0718676183668.issue24419@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-06-18 17:01:51paul.j3setrecipients: + paul.j3, py.user
2015-06-18 17:01:51paul.j3setmessageid: <1434646911.84.0.0718676183668.issue24419@psf.upfronthosting.co.za>
2015-06-18 17:01:51paul.j3linkissue24419 messages
2015-06-18 17:01:51paul.j3create