Message180012
| Author |
chris.jerdonek |
| Recipients |
bethard, chris.jerdonek |
| Date |
2013年01月15日.12:09:50 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1358251791.34.0.358251606196.issue16970@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foo', nargs='a')
...
File ".../Lib/argparse.py", line 1333, in add_argument
raise ValueError("length of metavar tuple does not match nargs")
ValueError: length of metavar tuple does not match nargs
The message should really be about nargs not having a valid value. The nargs value is invalid regardless of the metavar. There is also this:
>>> parser.add_argument('foo', nargs=-1)
_StoreAction(option_strings=[], dest='foo', nargs=-1, const=None, default=None, type=None, choices=None, help=None, metavar=None)
which is not consistent with this:
>>> parser.add_argument('foo', nargs=0)
...
raise ValueError('nargs for store actions must be > 0; if you '
ValueError: nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriate |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年01月15日 12:09:51 | chris.jerdonek | set | recipients:
+ chris.jerdonek, bethard |
| 2013年01月15日 12:09:51 | chris.jerdonek | set | messageid: <1358251791.34.0.358251606196.issue16970@psf.upfronthosting.co.za> |
| 2013年01月15日 12:09:50 | chris.jerdonek | link | issue16970 messages |
| 2013年01月15日 12:09:50 | chris.jerdonek | create |
|