diff options
author | steven.bethard <devnull@localhost> | 2009-12-06 22:26:34 +0000 |
---|---|---|
committer | steven.bethard <devnull@localhost> | 2009-12-06 22:26:34 +0000 |
commit | b2ea34ebaac78374545e3167761acb3976807382 (patch) | |
tree | b16e41be2912b61aa5ea94fb1a660afa0de14e72 /doc/source | |
parent | 0ffc2dc8c6e8e7d2ddcb8fa565b17002a3c84509 (diff) | |
download | argparse-b2ea34ebaac78374545e3167761acb3976807382.tar.gz |
Add get_default method.
Diffstat (limited to 'doc/source')
-rw-r--r-- | doc/source/other-methods.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/source/other-methods.rst b/doc/source/other-methods.rst index 9f523eb..1e9ca1d 100644 --- a/doc/source/other-methods.rst +++ b/doc/source/other-methods.rst @@ -67,6 +67,14 @@ Parser defaults Parser-level defaults can be particularly useful when you're working with multiple parsers. See the :meth:`add_subparsers` method for an example of this type. +.. method:: get_default(dest) + + Get the default value for a namespace attribute, as set by either :meth:`add_argument` or by :meth:`set_defaults`:: + + >>> parser = argparse.ArgumentParser() + >>> parser.add_argument('--foo', default='badger') + >>> parser.get_default('foo') + 'badger' Sub-commands ------------ |