[Python-checkins] [3.8] Fix error in argparse documentation example (GH-17399) (GH-21990)
Miss Islington (bot)
webhook-mailer at python.org
Fri Sep 4 18:26:30 EDT 2020
https://github.com/python/cpython/commit/e77547b90cb3b819113c722579a7fc070de0c2ca
commit: e77547b90cb3b819113c722579a7fc070de0c2ca
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-09-04T15:26:21-07:00
summary:
[3.8] Fix error in argparse documentation example (GH-17399) (GH-21990)
Automerge-Triggered-By: @rhettinger
(cherry picked from commit 8784d3300ec4ffc58bc0e9ab3cff9a24187dbe4c)
Co-authored-by: SarahPythonista <4283226+SarahPythonista at users.noreply.github.com>
files:
M Doc/library/argparse.rst
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index e1b28e32ed185..2ec7ea3ecb4e3 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1123,8 +1123,8 @@ keyword argument to :meth:`~ArgumentParser.add_argument`::
>>> parser.parse_args(['--foo', 'BAR'])
Namespace(foo='BAR')
>>> parser.parse_args([])
- usage: argparse.py [-h] [--foo FOO]
- argparse.py: error: option --foo is required
+ usage: [-h] --foo FOO
+ : error: the following arguments are required: --foo
As the example shows, if an option is marked as ``required``,
:meth:`~ArgumentParser.parse_args` will report an error if that option is not
More information about the Python-checkins
mailing list