[issue14149] argparse usage model requires argument names to be python identifiers

Steven Bethard report at bugs.python.org
Wed Feb 29 09:11:06 CET 2012


Steven Bethard <steven.bethard at gmail.com> added the comment:

For optional flags like --foo-bar, argparse does munge the "dest" to "foo_bar", following optparse. For positional arguments, arpgarse doesn't munge things this way, but if you want the argument named "foo-bar" in help messages and "foo_bar" on the Namespace object, you just need to do something like:

add_argument('foo_bar', metavar='foo-bar', ...)

Perhaps the docs could make this clearer.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14149>
_______________________________________


More information about the Python-bugs-list mailing list