Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(17)

Unified Diff: Doc/library/argparse.rst

Issue 16418: argparse with many choices can generate absurdly long usage message
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1005,7 +1005,7 @@
PROG: error: argument foo: '7' is not a perfect square
The choices_ keyword argument may be more convenient for type checkers that
-simply check against a range of values::
+simply check against a small range of values::
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('foo', type=int, choices=range(5, 10))
@@ -1021,11 +1021,11 @@
choices
^^^^^^^
-Some command-line arguments should be selected from a restricted set of values.
-These can be handled by passing a container object as the ``choices`` keyword
-argument to :meth:`~ArgumentParser.add_argument`. When the command line is
-parsed, argument values will be checked, and an error message will be displayed if
-the argument was not one of the acceptable values::
+Some command-line arguments should be selected from a small set of known
+values. These can be handled by passing a container object as the ``choices``
ezio.melotti 2012/11/17 18:38:56 Not your fault, but this should be *choices*.
cjerdonek 2012/11/17 18:49:14 I noticed and thought about this when creating the
+keyword argument to :meth:`~ArgumentParser.add_argument`. When the command
+line is parsed, if the value for such an argument is not one of the allowed
+choices, an error message will be displayed listing the allowed choices::
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('foo', choices='abc')
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+