[issue16970] argparse: bad nargs value raises misleading message
paul j3
report at bugs.python.org
Thu Apr 25 18:54:09 CEST 2013
paul j3 added the comment:
An integer nargs value is only used in one of 2 ways,
range(nargs)
'%s'*nargs
In both a negative value acts the same as a 0.
I don't think the original authors though much about 'what if the code user gives a negative value?', because nargs is counting things - the number of expected arguments. For some actions that number is 0. For other some sort of positive integer, or variable numbers like '*','+' make most sense.
To some degree nargs is modeled on the regex sequences, '*','+','?','{n}'. '{-1}' does not produce a regex error, though I can't make anything match it.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16970>
_______________________________________
More information about the Python-bugs-list
mailing list