[New-bugs-announce] [issue15433] argparse usage line is wrong
Reinis Ivanovs
report at bugs.python.org
Mon Jul 23 11:48:38 CEST 2012
New submission from Reinis Ivanovs <dabas at untu.ms>:
I set a positional argument and an optional argument that accepts a list:
> parser = argparse.ArgumentParser()
> parser.add_argument('foo')
> parser.add_argument('-bar', nargs='*')
The usage line I get from --help is this:
> $ example.py --help
> usage: example.py [-h] [-bar [BAR [BAR ...]]] foo
Trying to actually follow the usage instructions produces this error:
> $ example.py -bar x y z
> error: too few arguments
Reversing the argument order works however:
> $ example.py z -bar x y
So the usage instructions are clearly wrong.
----------
components: Library (Lib)
messages: 166217
nosy: reinis
priority: normal
severity: normal
status: open
title: argparse usage line is wrong
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15433>
_______________________________________
More information about the New-bugs-announce
mailing list