[Python-checkins] bpo-29030: Document interaction between *choices* and *metavar*. (GH-23884)

rhettinger webhook-mailer at python.org
Tue Dec 22 12:24:46 EST 2020


https://github.com/python/cpython/commit/6afb730e2a8bf0b472b4c3157bcf5b44aa7e6d56
commit: 6afb730e2a8bf0b472b4c3157bcf5b44aa7e6d56
branch: master
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2020-12-22T09:24:26-08:00
summary:

bpo-29030: Document interaction between *choices* and *metavar*. (GH-23884)

files:
M Doc/library/argparse.rst

diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 1a298cdd2b534..4542961d7816e 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1152,6 +1152,11 @@ Any container can be passed as the *choices* value, so :class:`list` objects,
 Use of :class:`enum.Enum` is not recommended because it is difficult to
 control its appearance in usage, help, and error messages.
 
+Formatted choices overrides the default *metavar* which is normally derived
+from *dest*.  This is usually what you want because the user never sees the
+*dest* parameter.  If this display isn't desirable (perhaps because there are
+many choices), just specify an explicit metavar_.
+
 
 required
 ^^^^^^^^



More information about the Python-checkins mailing list