diff options
Diffstat (limited to 'doc/source/other-methods.rst')
-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 ------------ |