Denver Coneybeare <denver.coneybe...@gmail.com> added the comment:

For kicks, I just took a look at this old, forgotten issue.  I agree with the 
submitter that add_argument() should fail if nargs and metavar do not match, 
instead of having format_help() raise the exception later on.

I've attached a patch (issue9348_patch_v01.txt) with a proposed fix and 
associated test cases.  The drawback of my approach is that if a custom 
HelpFormatter is used which has different semantics for metavar it could cause 
add_argument() to incorrectly reject the metavar value.  I'm not sure how 
common that is though.

----------
nosy: +denversc
Added file: http://bugs.python.org/file21294/issue9348_patch_v01.txt

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9348>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to