[Python-checkins] cpython (3.2): Issue #9349: add argparse.SUPPRESS to help doc

sandro.tosi python-checkins at python.org
Tue Jan 3 18:39:09 CET 2012


http://hg.python.org/cpython/rev/572ddf2770bc
changeset:   74242:572ddf2770bc
branch:      3.2
parent:      74233:cc346a672091
user:        Sandro Tosi <sandro.tosi at gmail.com>
date:        Tue Jan 03 18:37:03 2012 +0100
summary:
  Issue #9349: add argparse.SUPPRESS to help doc

files:
  Doc/library/argparse.rst |  11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -1051,6 +1051,17 @@
    optional arguments:
     -h, --help  show this help message and exit
 
+:mod:`argparse` supports silencing the help entry for certain options, by
+setting the ``help`` value to ``argparse.SUPPRESS``::
+
+   >>> parser = argparse.ArgumentParser(prog='frobble')
+   >>> parser.add_argument('--foo', help=argparse.SUPPRESS)
+   >>> parser.print_help()
+   usage: frobble [-h]
+
+   optional arguments:
+     -h, --help  show this help message and exit
+
 
 metavar
 ^^^^^^^

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list