[issue42973] argparse: mixing optional and positional arguments... not again
paul j3
report at bugs.python.org
Wed Jan 20 15:50:43 EST 2021
paul j3 <ajipanca at gmail.com> added the comment:
Your patch is incomplete, without documentation or tests.
Your example is incomplete. That is _CustomAction? What namespace does your patch produce.
It's been a while since I worked on the intermixed patch, but as I recall the OP was happy with the fix. Also I don't recall any talk about 'matching "optionals" with "positionals" with they relate to. Was that part of the discussion?
On Stackoverflow I have seen questions about pairing arguments, and answered some. I don't recall the best answers. The tough version is when some of the grouped inputs may be missing
In your example I'd suggest making '--tracks' a nargs=2 and 'append' option. 'choices' would have to be replaced with a either a custom 'type', a custom Action, or post-parsing testing.
I haven't had time yet to test your patch.
One question I frequently ask posters who want to parse complex inputs is: 'how are going to explain this to your users?' 'What kind of usage and help do you want see?'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42973>
_______________________________________
More information about the Python-bugs-list
mailing list