# HG changeset patch # User Éric Araujo # Date 1302990574 -7200 # Node ID 5b94516912773acb6f9d3d2dce6bcb3f3fc0f560 # Parent 2aea51cb0d1dccc679cec4c144b1c0a7869d7c41 Use a class directive to create a target for class roles diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -110,7 +110,7 @@ Parsing arguments :class:`ArgumentParser` parses args through the :meth:`~ArgumentParser.parse_args` method. This will inspect the command-line, convert each arg to the appropriate type and then invoke the appropriate action. -In most cases, this means a simple namespace object will be built up from +In most cases, this means a simple :class:`Namespace` object will be built up from attributes parsed out of the command-line:: >>> parser.parse_args(['--sum', '7', '-1', '42']) @@ -732,7 +732,7 @@ the Action API. The easiest way to do t * ``parser`` - The ArgumentParser object which contains this action. -* ``namespace`` - The namespace object that will be returned by +* ``namespace`` - The :class:`Namespace` object that will be returned by :meth:`parse_args`. Most actions add an attribute to this object. * ``values`` - The associated command-line args, with any type-conversions @@ -1338,11 +1338,14 @@ of :data:`sys.argv`. This can be accomp The Namespace object ^^^^^^^^^^^^^^^^^^^^ -By default, :meth:`parse_args` will return a new object of type :class:`Namespace` -where the necessary attributes have been set. This class is deliberately simple, -just an :class:`object` subclass with a readable string representation. If you -prefer to have dict-like view of the attributes, you can use the standard Python -idiom via :func:`vars`:: +.. class:: Namespace + + Simple class used by default by :meth:`parse_args` to create an object + holding attributes and return it. + +This class is deliberately simple, just an :class:`object` subclass with a +readable string representation. If you prefer to have dict-like view of the +attributes, you can use the standard Python idiom, :func:`vars`:: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo')