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 bethard
Recipients bethard, eric.smith, jeffknupp, kalt, r.david.murray, wt
Date 2012-03-18.21:41:39
SpamBayes Score 7.598379e-07
Marked as misclassified No
Message-id <1332106899.97.0.563731511313.issue13922@psf.upfronthosting.co.za>
In-reply-to
Content
> It prevents implementing parsers that pass strings on to another 
> sub-parser or command.
...
> wouldn't you use 'parse_known_args' instead of 'parse_args'
> and pass the remaining arguments to the next script

I'll just say again that the recommended way of passing arguments to another command is via nargs=argparse.REMAINDER. (Though you may still need "--" if the first argument in the remainder is a flag shared by your parser, as Warren Turka pointed out.)

> I really want "--" to mean "treat everything else as non-optional 
> arguments"

Yep, and that's what it's intended to mean, and what the documentation says:

"you can insert the pseudo-argument '--' which tells parse_args() that everything after that is a positional argument"
http://docs.python.org/library/argparse.html#arguments-containing

It's therefore a bug if there's a '--' after the first '--', but it's not being treated as a positional argument.
History
Date User Action Args
2012-03-18 21:41:40bethardsetrecipients: + bethard, eric.smith, kalt, r.david.murray, wt, jeffknupp
2012-03-18 21:41:39bethardsetmessageid: <1332106899.97.0.563731511313.issue13922@psf.upfronthosting.co.za>
2012-03-18 21:41:39bethardlinkissue13922 messages
2012-03-18 21:41:39bethardcreate