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 Danh, alclarks, atfrase, bethard, paul.j3, rhettinger, shihai1991, wm
Date 2019-11-03.16:40:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572799224.25.0.851286645234.issue11354@roundup.psfhosted.org>
In-reply-to
Content
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)
History
Date User Action Args
2019-11-03 16:40:24paul.j3setrecipients: + paul.j3, rhettinger, bethard, Danh, wm, atfrase, shihai1991, alclarks
2019-11-03 16:40:24paul.j3setmessageid: <1572799224.25.0.851286645234.issue11354@roundup.psfhosted.org>
2019-11-03 16:40:24paul.j3linkissue11354 messages
2019-11-03 16:40:23paul.j3create