[issue14074] argparse allows nargs>1 for positional arguments but doesn't allow metavar to be a tuple

paul j3 report at bugs.python.org
Sun Apr 27 08:24:21 CEST 2014


paul j3 added the comment:

This patch fixes both help and error formatting.

A module level '_format_metavars' does the formatting for both.

I have tried several alternatives, including using the 'usage' style.

There is similarity between this fix and that for issue 16468 (custom choices), though I don't think they conflict.  In both cases, code needed to format the usage or help is also needed to help format error messages.

Issue 9849 (better nargs warning) is another case where error checking in the parser depends on the formatter.  In the long run we may want to refactor these issues.

----------
Added file: http://bugs.python.org/file35049/issue14074_1.patch

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


More information about the Python-bugs-list mailing list