bpo-38678: Improve argparse example in tutorial (GH-17207) (GH-17212)
(cherry picked from commit 04c79d6088a22d467f04dbe438050c26de22fa85)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 5a61a5b..e1b28e3 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -782,10 +782,12 @@
example, this is useful for increasing verbosity levels::
>>> parser = argparse.ArgumentParser()
- >>> parser.add_argument('--verbose', '-v', action='count')
+ >>> parser.add_argument('--verbose', '-v', action='count', default=0)
>>> parser.parse_args(['-vvv'])
Namespace(verbose=3)
+ Note, the *default* will be ``None`` unless explicitly set to *0*.
+
* ``'help'`` - This prints a complete help message for all the options in the
current parser and then exits. By default a help action is automatically
added to the parser. See :class:`ArgumentParser` for details of how the