bpo-32225: Implementation of PEP 562 by ilevkivskyi · Pull Request #4731 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can you use :data: directive. Here's the definition in the Documentation Guide:

data

    Describes global data in a module, including both variables and values used as
   “defined constants.” Class and object attributes are not documented using this directive.

Where the __dict__ is defined:

   .. index:: single: __dict__ (module attribute)
   .. data:: __dict__

   Special read-only attribute: :attr:`~object.__dict__` is the module's
   namespace as a dictionary object.

and then where you want to link:

:meth:`object.__getattribute__`, then ``__getattr__`` is searched in
the module :data:`__dict__` before raising an :exc:`AttributeError`.

As you mentioned, this may require fixing other links for module.__dict__ that now point to object.__dict__.