@@ -1124,21 +1124,28 @@ if the argument was not one of the acceptable values::
11241124 game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',
11251125 'paper', 'scissors')
11261126
1127- Note that inclusion in the *choices * sequence is checked after any type _
1128- conversions have been performed, so the type of the objects in the *choices *
1129- sequence should match the type _ specified.
1130-
11311127Any sequence can be passed as the *choices * value, so :class: `list ` objects,
11321128:class: `tuple ` objects, and custom sequences are all supported.
11331129
1134- Use of :class: `enum.Enum ` is not recommended because it is difficult to
1135- control its appearance in usage, help, and error messages.
1136-
11371130Formatted choices override the default *metavar * which is normally derived
11381131from *dest *. This is usually what you want because the user never sees the
11391132*dest * parameter. If this display isn't desirable (perhaps because there are
11401133many choices), just specify an explicit metavar _.
11411134
1135+ Note that inclusion in the *choices * sequence is checked after any type _
1136+ conversions have been performed, so the type of the objects in the *choices *
1137+ sequence should match the type _ specified. This may interfere with
1138+ the display of the choices in usage, help and error messages, because the
1139+ *choices * may not be familiar to the end-user.
1140+
1141+ Use of :class: `enum.Enum ` is not recommended because it is difficult to
1142+ control its appearance in these messages.
1143+
1144+ If you have to use both *type * and *choices * you can use a wrapper class
1145+ that formats the value after type conversion back to the vocabulary of the
1146+ end-user. However, it is usually easier to not specify *type * and perform
1147+ type conversion in application code.
1148+
11421149
11431150.. _required :
11441151
0 commit comments