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 paul.j3
Recipients monkeyman79, paul.j3, r.david.murray, v+python
Date 2021-01-27.21:13:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611781996.44.0.0605969591679.issue42973@roundup.psfhosted.org>
In-reply-to
Content
Sometimes patches have unforeseen benefits.  My earlier patch for this issue, parse_intermixed_args, has been useful beyond the OP's case.

https://stackoverflow.com/questions/50916124/allow-positional-command-line-arguments-with-nargs-to-be-seperated-by-a-flag

https://bugs.python.org/issue15112
argparse: nargs='*' positional argument doesn't accept any items if preceded by an option and another positional

With

     usage: test.py [-h] [-a A] b [c]

and 

     test.py B -a A C

has problems because the optional '[c]' positional is used up when 'b' is processed.   Intermixed gets around this by first processing '-a', and then handling 'b [c]' together.
History
Date User Action Args
2021-01-27 21:13:16paul.j3setrecipients: + paul.j3, v+python, r.david.murray, monkeyman79
2021-01-27 21:13:16paul.j3setmessageid: <1611781996.44.0.0605969591679.issue42973@roundup.psfhosted.org>
2021-01-27 21:13:16paul.j3linkissue42973 messages
2021-01-27 21:13:16paul.j3create