Issue #24314: Add links for general attributes like __name__, __dict__
diff --git a/Doc/library/__builtin__.rst b/Doc/library/__builtin__.rst
index 673d74f..cb8b53a 100644
--- a/Doc/library/__builtin__.rst
+++ b/Doc/library/__builtin__.rst
@@ -39,6 +39,6 @@
Most modules have the name ``__builtins__`` (note the ``'s'``) made available
as part of their globals. The value of ``__builtins__`` is normally either
- this module or the value of this modules's :attr:`__dict__` attribute. Since
+ this module or the value of this modules's :attr:`~object.__dict__` attribute. Since
this is an implementation detail, it may not be used by alternate
implementations of Python.
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 20372b3..350bc71 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -311,7 +311,7 @@
:func:`dir` reports their attributes.
If the object does not provide :meth:`__dir__`, the function tries its best to
- gather information from the object's :attr:`__dict__` attribute, if defined, and
+ gather information from the object's :attr:`~object.__dict__` attribute, if defined, and
from its type object. The resulting list is not necessarily complete, and may
be inaccurate when the object has a custom :func:`__getattr__`.
@@ -1477,7 +1477,7 @@
With three arguments, return a new type object. This is essentially a
dynamic form of the :keyword:`class` statement. The *name* string is the
- class name and becomes the :attr:`~class.__name__` attribute; the *bases* tuple
+ class name and becomes the :attr:`~definition.__name__` attribute; the *bases* tuple
itemizes the base classes and becomes the :attr:`~class.__bases__` attribute;
and the *dict* dictionary is the namespace containing definitions for class
body and becomes the :attr:`~object.__dict__` attribute. For example, the
@@ -1545,11 +1545,11 @@
.. function:: vars([object])
Return the :attr:`~object.__dict__` attribute for a module, class, instance,
- or any other object with a :attr:`__dict__` attribute.
+ or any other object with a :attr:`~object.__dict__` attribute.
- Objects such as modules and instances have an updateable :attr:`__dict__`
+ Objects such as modules and instances have an updateable :attr:`~object.__dict__`
attribute; however, other objects may have write restrictions on their
- :attr:`__dict__` attributes (for example, new-style classes use a
+ :attr:`~object.__dict__` attributes (for example, new-style classes use a
dictproxy to prevent direct dictionary updates).
Without an argument, :func:`vars` acts like :func:`locals`. Note, the
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 10dbd0f..f3e396b 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -185,7 +185,7 @@
:class:`partial` objects are like :class:`function` objects in that they are
callable, weak referencable, and can have attributes. There are some important
-differences. For instance, the :attr:`__name__` and :attr:`__doc__` attributes
+differences. For instance, the :attr:`~definition.__name__` and :attr:`__doc__` attributes
are not created automatically. Also, :class:`partial` objects defined in
classes behave like static methods and do not transform into bound methods
during instance attribute look-up.
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 1964f71..c1b7bec 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -335,9 +335,11 @@
are true.
This is new as of Python 2.2, and, for example, is true of
- ``int.__add__``. An object passing this test has a :attr:`__get__` attribute
- but not a :attr:`__set__` attribute, but beyond that the set of attributes
- varies. :attr:`__name__` is usually sensible, and :attr:`__doc__` often is.
+ ``int.__add__``. An object passing this test
+ has a :meth:`~object.__get__` method but not a :meth:`~object.__set__`
+ method, but beyond that the set of attributes varies. A
+ :attr:`~definition.__name__` attribute is usually
+ sensible, and :attr:`__doc__` often is.
Methods implemented via descriptors that also pass one of the other tests
return false from the :func:`ismethoddescriptor` test, simply because the
@@ -349,11 +351,11 @@
Return true if the object is a data descriptor.
- Data descriptors have both a :attr:`__get__` and a :attr:`__set__` attribute.
+ Data descriptors have both a :attr:`~object.__get__` and a :attr:`~object.__set__` method.
Examples are properties (defined in Python), getsets, and members. The
latter two are defined in C and there are more specific tests available for
those types, which is robust across Python implementations. Typically, data
- descriptors will also have :attr:`__name__` and :attr:`__doc__` attributes
+ descriptors will also have :attr:`~definition.__name__` and :attr:`__doc__` attributes
(properties, getsets, and members have both of these attributes), but this is
not guaranteed.
diff --git a/Doc/library/restricted.rst b/Doc/library/restricted.rst
index 80f6344..fd07ab3 100644
--- a/Doc/library/restricted.rst
+++ b/Doc/library/restricted.rst
@@ -48,7 +48,7 @@
Python code executing in restricted mode faces a number of limitations that are
designed to prevent it from escaping from the padded cell. For instance, the
function object attribute :attr:`func_globals` and the class and instance object
-attribute :attr:`__dict__` are unavailable.
+attribute :attr:`~object.__dict__` are unavailable.
Two modules provide the framework for setting up restricted execution
environments:
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 6a47cdf..7cecfef 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2927,9 +2927,10 @@
A special attribute of every module is :attr:`~object.__dict__`. This is the
dictionary containing the module's symbol table. Modifying this dictionary will
actually change the module's symbol table, but direct assignment to the
-:attr:`__dict__` attribute is not possible (you can write
+:attr:`~object.__dict__` attribute is not possible (you can write
``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write
-``m.__dict__ = {}``). Modifying :attr:`__dict__` directly is not recommended.
+``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is
+not recommended.
Modules built into the interpreter are written like this: ``<module 'sys'
(built-in)>``. If loaded from a file, they are written as ``<module 'os' from
@@ -3156,9 +3157,10 @@
The tuple of base classes of a class object.
-.. attribute:: class.__name__
+.. attribute:: definition.__name__
- The name of the class or type.
+ The name of the class, type, function, method, descriptor, or
+ generator instance.
The following attributes are only supported by :term:`new-style class`\ es.