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 py.user
Recipients paul.j3, py.user
Date 2015-06-18.19:29:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
paul j3 wrote:
> You can give the positional any custom name (the first parameter).

The dest argument is not required for giving name for an optional.
You can either make it automatically or set by dest, it's handy and clear.

>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> _ = parser.add_argument('-a', '--aa')
>>> _ = parser.add_argument('-b', '--bb', dest='x')
>>> args = parser.parse_args([])
>>> print(args)
Namespace(aa=None, x=None)

But if you do the same thing with a positional, it throws an exception. Why?
(I'm a UNIX user and waiting predictable behaviour.)

And the situation with another action (not only append_const, but future extensions) shows that dest may be required.
Date User Action Args
2015-06-18 19:29:00py.usersetrecipients: + py.user, paul.j3
2015-06-18 19:29:00py.usersetmessageid: <>
2015-06-18 19:29:00py.userlinkissue24419 messages
2015-06-18 19:29:00py.usercreate