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

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


http://hg.python.org/cpython/rev/17b7b856cbe8
changeset:   74243:17b7b856cbe8
branch:      2.7
parent:      74232:0c10061df711
user:        Sandro Tosi <sandro.tosi at gmail.com>
date:        Tue Jan 03 18:31:51 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
@@ -1049,6 +1049,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