homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author v+python
Recipients v+python
Date 2012年03月04日.06:36:29
SpamBayes Score 2.8379796e-05
Marked as misclassified No
Message-id <1330843053.88.0.983162018395.issue14191@psf.upfronthosting.co.za>
In-reply-to
Content
To me, "all positional parameters" mean whether they are in the front, back or middle, as long as they are not diriectly preceded by an option that can accept an unlimited number of parameters.
from argparse import ArgumentParser, SUPPRESS, REMAINDER
import sys
print( sys.version )
parser = ArgumentParser()
parser.add_argument('--foo', dest='foo')
parser.add_argument('--bar', dest='bar')
parser.add_argument('baz', nargs='*')
print( parser.parse_args('a b --foo x --bar 1 c d'.split()))
# expected: Namespace(bar='1', baz=['a', 'b', 'c', 'd'], foo='x')
# actual: error: unrecognized arguments: c d
Above also supplied as a test file, t12.py
History
Date User Action Args
2012年03月04日 06:37:34v+pythonsetrecipients: + v+python
2012年03月04日 06:37:33v+pythonsetmessageid: <1330843053.88.0.983162018395.issue14191@psf.upfronthosting.co.za>
2012年03月04日 06:36:30v+pythonlinkissue14191 messages
2012年03月04日 06:36:30v+pythoncreate

AltStyle によって変換されたページ (->オリジナル) /