[Python-checkins] gh-99735: Use required=True in argparse subparsers example (GH-100927)

miss-islington webhook-mailer at python.org
Sun Feb 19 14:35:16 EST 2023


https://github.com/python/cpython/commit/f193fad4b3f4a8892f6af000ae3801d58b8b66f8
commit: f193fad4b3f4a8892f6af000ae3801d58b8b66f8
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2023-02-19T11:35:09-08:00
summary:

gh-99735: Use required=True in argparse subparsers example (GH-100927)

(cherry picked from commit 6aab56f3c2ee331116eba242d2fcdca592577328)

Co-authored-by: Patricio Paez <nospam at pp.com.mx>

files:
M Doc/library/argparse.rst

diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 3971c000b2a0..b6ecf8a2542c 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1771,7 +1771,7 @@ Sub-commands
      ...
      >>> # create the top-level parser
      >>> parser = argparse.ArgumentParser()
-     >>> subparsers = parser.add_subparsers()
+     >>> subparsers = parser.add_subparsers(required=True)
      >>>
      >>> # create the parser for the "foo" command
      >>> parser_foo = subparsers.add_parser('foo')



More information about the Python-checkins mailing list