@@ -755,7 +755,7 @@ The add_argument() method
755
755
756
756
* type _ - The type to which the command-line argument should be converted.
757
757
758
- * choices _ - A container of the allowable values for the argument.
758
+ * choices _ - A sequence of the allowable values for the argument.
759
759
760
760
* required _ - Whether or not the command-line option may be omitted
761
761
(optionals only).
@@ -1199,7 +1199,7 @@ choices
1199
1199
^^^^^^^
1200
1200
1201
1201
Some command-line arguments should be selected from a restricted set of values.
1202
- These can be handled by passing a container object as the *choices * keyword
1202
+ These can be handled by passing a sequence object as the *choices * keyword
1203
1203
argument to :meth: `~ArgumentParser.add_argument `. When the command line is
1204
1204
parsed, argument values will be checked, and an error message will be displayed
1205
1205
if the argument was not one of the acceptable values::
@@ -1213,9 +1213,9 @@ if the argument was not one of the acceptable values::
1213
1213
game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',
1214
1214
'paper', 'scissors')
1215
1215
1216
- Note that inclusion in the *choices * container is checked after any type _
1216
+ Note that inclusion in the *choices * sequence is checked after any type _
1217
1217
conversions have been performed, so the type of the objects in the *choices *
1218
- container should match the type _ specified::
1218
+ sequence should match the type _ specified::
1219
1219
1220
1220
>>> parser = argparse.ArgumentParser(prog='doors.py')
1221
1221
>>> parser.add_argument('door', type=int, choices=range(1, 4))
@@ -1225,8 +1225,8 @@ container should match the type_ specified::
1225
1225
usage: doors.py [-h] {1,2,3}
1226
1226
doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)
1227
1227
1228
- Any container can be passed as the *choices * value, so :class: `list ` objects,
1229
- :class: `set ` objects, and custom containers are all supported.
1228
+ Any sequence can be passed as the *choices * value, so :class: `list ` objects,
1229
+ :class: `tuple ` objects, and custom sequences are all supported.
1230
1230
1231
1231
Use of :class: `enum.Enum ` is not recommended because it is difficult to
1232
1232
control its appearance in usage, help, and error messages.
0 commit comments