Domen Kožar <[email protected]> added the comment:
I agree — not the best example, here is a better one explaining what behavior
should not exist:
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foobar', action='store')
>>> parser.add_argument('foobar2', nargs='?')
>>> parser.add_argument('foobar3', nargs='*')
>>> print parser.parse_args(['foo', '--', 'foo3', 'foo3'])
Namespace(foobar='foo', foobar2='foo3', foobar3=['foo3'])
I would expect both foo3 to be part of foobar3. This does not happen because of
foobar2 argument eating zero or one argument. Arguments after -- should be left
unparsed as such behavior was in optparse.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9077>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com