New submission from Walter Mundt <[email protected]>:
Test case:
from argparse import *
parser = ArgumentParser()
parser.add_argument('-x', action='store_true')
parser.add_argument('y')
parser.add_argument('z', nargs='*')
print parser.parse_args('yy -x zz'.split(' '))
The result of this is that the "z" option is unfilled, and the "zz" argument is
unrecognized, resulting in an error. Changing the 'nargs' to '+' works in this
case, but results in errors if the 'zz' is left off.
----------
messages: 163249
nosy: waltermundt
priority: normal
severity: normal
status: open
title: argparse: nargs='*' positional argument doesn't accept any items if
preceded by an option and another positional
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15112>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com