diff --git a/Doc/conf.py b/Doc/conf.py index 458954370debe2..318024e0d12f23 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -255,6 +255,7 @@ ('py:meth', '__missing__'), ('py:attr', '__wrapped__'), ('py:meth', 'index'), # list.index, tuple.index, etc. + ('py:meth', 'set.add'), ] # gh-106948: Copy standard C types declared in the "c:type" domain to the diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 9028ff5c134fa9..bcd5ad7f3ee31c 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -5492,6 +5492,17 @@ types, where they are relevant. Some of these are not reported by the The tuple of base classes of a class object. +.. attribute:: definition.__module__ + + The name of the module in which the class or function was defined. + + +.. attribute:: definition.__doc__ + + The documentation string of the class, function, method, descriptor, + generator instance, or ``None`` if undefined. + + .. attribute:: definition.__name__ The name of the class, function, method, descriptor, or diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 0a1c1d58558e94..5638a47ef64fae 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -885,7 +885,7 @@ Predefined (writable) attributes: :attr:`__name__` The module's name. - :attr:`__doc__` + :attr:`~definition.__doc__` The module's documentation string, or ``None`` if unavailable. @@ -976,7 +976,7 @@ Special attributes: :attr:`~definition.__name__` The class name. - :attr:`__module__` + :attr:`~definition.__module__` The name of the module in which the class was defined. :attr:`~object.__dict__` @@ -986,7 +986,7 @@ Special attributes: A tuple containing the base classes, in the order of their occurrence in the base class list. - :attr:`__doc__` + :attr:`~definition.__doc__` The class's documentation string, or ``None`` if undefined. :attr:`__annotations__` @@ -996,7 +996,7 @@ Special attributes: working with :attr:`__annotations__`, please see :ref:`annotations-howto`. - :attr:`__type_params__` + :attr:`~definition.__type_params__` A tuple containing the :ref:`type parameters ` of a :ref:`generic class `. @@ -1563,8 +1563,8 @@ When implementing a class that emulates any built-in type, it is important that the emulation only be implemented to the degree that it makes sense for the object being modelled. For example, some sequences may work well with retrieval of individual elements, but extracting a slice may not make sense. (One example -of this is the :class:`~xml.dom.NodeList` interface in the W3C's Document -Object Model.) +of this is the class ``NodeList`` interface in the W3C's Document +Object Model, see :ref:`dom-nodelist-objects`.) .. _customization: @@ -2334,7 +2334,7 @@ class defining the method. .. versionadded:: 3.6 -When a class is created, :meth:`type.__new__` scans the class variables +When a class is created, :meth:`!type.__new__` scans the class variables and makes callbacks to those with a :meth:`~object.__set_name__` hook. .. method:: object.__set_name__(self, owner, name) diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index bebd92bffad46a..e64ee094e34b75 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -94,7 +94,6 @@ Doc/library/xmlrpc.client.rst Doc/library/xmlrpc.server.rst Doc/library/zlib.rst Doc/reference/compound_stmts.rst -Doc/reference/datamodel.rst Doc/reference/import.rst Doc/tutorial/datastructures.rst Doc/using/windows.rst