From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 4 Sep 2020 22:26:21 +0000 (-0700) Subject: [3.8] Fix error in argparse documentation example (GH-17399) (GH-21990) X-Git-Tag: v3.8.6rc1~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e77547b90cb3b819113c722579a7fc070de0c2ca;p=thirdparty%2FPython%2Fcpython.git [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@users.noreply.github.com> --- diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index e1b28e32ed18..2ec7ea3ecb4e 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