Skip to content

Commit dfad850

Browse files
authored
Fix invalid choices documentation
1 parent c9932a9 commit dfad850

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/argparse.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ are strings::
599599
>>> parser.add_argument('integers', metavar='N', type=int, nargs='+',
600600
... help='an integer for the accumulator')
601601
>>> parser.parse_args(['--action', 'sumn', 1, 2, 3])
602-
tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant 'sum'? (choose from 'sum', 'max')
602+
tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant 'sum'? (choose from sum, max)
603603

604604
If you're writing code that needs to be compatible with older Python versions
605605
and want to opportunistically use ``suggest_on_error`` when it's available, you
@@ -1121,8 +1121,8 @@ if the argument was not one of the acceptable values::
11211121
Namespace(move='rock')
11221122
>>> parser.parse_args(['fire'])
11231123
usage: game.py [-h] {rock,paper,scissors}
1124-
game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',
1125-
'paper', 'scissors')
1124+
game.py: error: argument move: invalid choice: 'fire' (choose from rock,
1125+
paper, scissors)
11261126

11271127
Note that inclusion in the *choices* sequence is checked after any type_
11281128
conversions have been performed, so the type of the objects in the *choices*

0 commit comments

Comments
 (0)