[docs] [issue14191] argparse doesn't allow optionals within positionals

Steven Bethard report at bugs.python.org
Mon Jul 23 00:16:22 CEST 2012

Steven Bethard <steven.bethard at gmail.com> added the comment:

I created Issue 15427 for the parse_args documentation bug. So let's make this issue just about parsing intermixed arguments.

Yes, if someone would like to provide a patch for this, please create a method "parse_intermixed_args" rather than adding a boolean flag parameter. It should be basically equivalent to this code:

args, remaining_args = optionals.parse_known_args()
args = positionals.parse_args(remaining_args, args)

Except that it should give proper error messages. There should be some tests to make sure both that it parses things as expected and that it gives error messages as expected.

assignee: docs at python -> 
components:  -Documentation
title: argparse: nargs='*' doesn't get out-of-order positional parameters -> argparse doesn't allow optionals within positionals
versions: +Python 3.4 -Python 2.7, Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the docs mailing list