Skip to content

Commit 6afb730

Browse files
authored
bpo-29030: Document interaction between *choices* and *metavar*. (GH-23884)
1 parent 60eccd0 commit 6afb730

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/argparse.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,11 @@ Any container can be passed as the *choices* value, so :class:`list` objects,
11521152
Use of :class:`enum.Enum` is not recommended because it is difficult to
11531153
control its appearance in usage, help, and error messages.
11541154

1155+
Formatted choices overrides the default *metavar* which is normally derived
1156+
from *dest*. This is usually what you want because the user never sees the
1157+
*dest* parameter. If this display isn't desirable (perhaps because there are
1158+
many choices), just specify an explicit metavar_.
1159+
11551160

11561161
required
11571162
^^^^^^^^

0 commit comments

Comments
 (0)