New submission from Glenn Linderman <v+pyt...@g.nevcal.com>: 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 ---------- components: Library (Lib) files: t12.py messages: 154880 nosy: v+python priority: normal severity: normal status: open title: argparse: nargs='*' doesn't parse all positional parameters type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file24726/t12.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14191> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com