paul j3 <[email protected]> added the comment:
A couple of quick observations:
- this is one of the first patches that I worked on, so the details aren't
fresh in my mind. A glance at my latest patch show that this isn't a trivial
change.
- nargs changes affect the input handling, the parsing, help and usage
formatting, and error formatting. As a result, nargs are referenced in several
places in the code. That complicates maintenance and the addition of new
features. Help formatting is particularly brittle; just look at the number of
issues that deal with 'metavar' to get a sense of that.
- At one point I tried to refactor the code to consolidate the nargs handling
in a few functions. I don't recall if I posted that as a patch.
- The first posts on this topic suggested a (n,m) notation; I proposed a regex
like {n,m}. There wasn't any further discussion.
- Note that the initial posts were in 2011 when Steven (the original author)
was involved. I posted in 2013. There hasn't been any further action until
now. I don't recall much interest in this topic on Stackoverflow either. So
my sense is that this isn't a pressing issue.
- It's easy to test for this range after parsing, with '*' or '+' nargs. So
the main thing this patch adds is in the help/usage display. It doesn't add
significant functionality.
- cross links:
https://bugs.python.org/issue9849 - Argparse needs better error handling for
nargs
https://bugs.python.org/issue16468 - argparse only supports iterable choices
(recently closed)
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue11354>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com