https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy There is a table of "special attributes" of user-defined functions. The __name__ attribute name is a link, but it leads to something quite irrelevant: the description of __name__ attribute of imported modules. In Doc/reference/datamodel.rst, there is nothing special about __name__ attribute, so it looks like some random spasm of Sphinx creating links here and there. My knowledge of rst is not sufficient to suppress it.
I think the proper way to suppress the link is :attr:`!__name__`. However I am posting a patch which takes a different approach. I tweaked some of the entries under <https://docs.python.org/dev/library/stdtypes.html#special-attributes> that also apply to functions, etc. I invented the pseudo class name “definition” for this; better suggestions are welcome! Then I converted the user-defined functions reference, as well as many other references, to :attr:`~definition.__name__` or similar, for these three attributes: * definition.__name__ * definition.__qualname__ * object.__dict__ I also moved the index markup so that the index entries for the table of function attributes work.