[issue9077] argparse does not handle arguments correctly after --

Domen Kožar report at bugs.python.org
Mon Jun 28 19:04:54 CEST 2010


Domen Kožar <ielectric at gmail.com> added the comment:

I always used optparse like this, using the rargs (maybe this is not main intention, but worked so far):

>>> import optparse
>>> parser = optparse.OptionParser()
>>> parser.add_option('--test', action='store_true')
<Option at 0x7f55bdb32dd0: --test>
>>> parser.parse_args(['--test', 'foo', 'foo1', '--', 'foo2', 'foo3'])
(<Values at 0x7f55bda89170: {'test': True}>, ['foo', 'foo1', 'foo2', 'foo3'])
>>> parser.rargs
['foo2', 'foo3']
>>> parser.largs
['foo', 'foo1']

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9077>
_______________________________________


More information about the Python-bugs-list mailing list