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 elsdoerfer
Recipients elsdoerfer
Date 2010-08-11.19:21:24
SpamBayes Score 3.5398389e-06
Marked as misclassified No
Message-id <1281554487.14.0.725527410465.issue9571@psf.upfronthosting.co.za>
In-reply-to
Content
argparse already seems to support -- to indicate that what follows are positional arguments. However, I would like to parse something like:

./script.py --ignore one two -- COMMAND

I.e., --ignore is an nargs='+' argument, and I need a way to break out of --ignore and have argparse consider what follows on it's own merits. If COMMAND in the above example refers to a subparser, this won't work:

error: invalid choice: '--' (choose from 'command1', 'command2', 'command3')

I'm not sure what's the best solution here. Allowing -- here would change the semantics of forcing everything that follows to be positional arguments, since the subparser might have flags. I'm not sure if that is what is required by Unix conventions, but if not, then I think it makes sense to allow -- to be followed by a subparser.
History
Date User Action Args
2010-08-11 19:21:27elsdoerfersetrecipients: + elsdoerfer
2010-08-11 19:21:27elsdoerfersetmessageid: <1281554487.14.0.725527410465.issue9571@psf.upfronthosting.co.za>
2010-08-11 19:21:25elsdoerferlinkissue9571 messages
2010-08-11 19:21:24elsdoerfercreate