Author chris.jerdonek
Recipients bethard, chris.jerdonek
Date 2013-01-27.08:51:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359276661.57.0.274871702559.issue17050@psf.upfronthosting.co.za>
In-reply-to
Content
Works:

>>> p = ArgumentParser(prog='test.py')
>>> p.add_argument('pos')
>>> p.add_argument('remainder', nargs=argparse.REMAINDER)
>>> p.parse_args(['abc', '--def'])
Namespace(pos='abc', remainder=['--def'])

Doesn't work:

>>> p = ArgumentParser(prog='test.py')
>>> p.add_argument('remainder', nargs=argparse.REMAINDER)
>>> p.parse_args(['--def'])
usage: test.py [-h] ...
test.py: error: unrecognized arguments: --def

This use case comes up, for example, if you would like to extract all the arguments passed to a subparser in order to pass to a different program.
History
Date User Action Args
2013-01-27 08:51:01chris.jerdoneksetrecipients: + chris.jerdonek, bethard
2013-01-27 08:51:01chris.jerdoneksetmessageid: <1359276661.57.0.274871702559.issue17050@psf.upfronthosting.co.za>
2013-01-27 08:51:01chris.jerdoneklinkissue17050 messages
2013-01-27 08:51:01chris.jerdonekcreate