Author paul.j3
Recipients Christophe.Guillon, Clint Olsen, abacabadabacaba, amcnabb, andersk, bethard, cben, danielsh, davidben, drm, eric.araujo, eric.smith, gdb, gfxmonk, martin.panter, memeplex, nelhage, paul.j3, r.david.murray, skilletaudio, spaceone
Date 2016-09-15.22:48:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473979714.67.0.284962975128.issue9334@psf.upfronthosting.co.za>
In-reply-to
Content
Clint, the problem is the argparse uses different argument allocation method than optparse.

optparse gives the '--subscipt_args` Action all of the remaining strings, and says - 'consume what you want, and return the rest'.  So you consume up to (and including) the '--'.  Then optparse continues with the rest.

argparse performs the double pass described earlier, and allocates strings to each Action based on the larger context.  It gives as many as the Action's nargs requires, but tries in various ways to reserve strings for other Actions.  Individual Actions never see the big picture.

So the 'REMAINDER' action has to be last (with this '--' positional exception).  Your users will have to use the other flags Actions first.

One alternative comes to mind:

- omit the final positional
- use parse_known_args instead of parse_args

Then the 'extras' list will be something like:  ['--', '--verbose'], which you can handle in another parser.
History
Date User Action Args
2016-09-15 22:48:34paul.j3setrecipients: + paul.j3, cben, amcnabb, bethard, eric.smith, eric.araujo, r.david.murray, memeplex, gfxmonk, andersk, abacabadabacaba, gdb, nelhage, drm, davidben, martin.panter, skilletaudio, Christophe.Guillon, danielsh, spaceone, Clint Olsen
2016-09-15 22:48:34paul.j3setmessageid: <1473979714.67.0.284962975128.issue9334@psf.upfronthosting.co.za>
2016-09-15 22:48:34paul.j3linkissue9334 messages
2016-09-15 22:48:34paul.j3create