This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: irrelevant cross-link in documentation of user-defined functions
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, july, martin.panter, python-dev
Priority: normal Keywords: patch

Created on 2015-05-28 14:27 by july, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
special-attr.patch martin.panter, 2015-05-29 04:12 review
Messages (4)
msg244301 - (view) Author: July Tikhonov (july) * Date: 2015-05-28 14:27
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.
msg244358 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-05-29 04:12
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.
msg268776 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-18 08:23
New changeset 1ed4e4a168bb by Martin Panter in branch '2.7':
Issue #24314: Add links for general attributes like __name__, __dict__
https://hg.python.org/cpython/rev/1ed4e4a168bb

New changeset 4c361e189747 by Martin Panter in branch '3.5':
Issue #24314: Fix doc links for general attributes like __name__, __dict__
https://hg.python.org/cpython/rev/4c361e189747

New changeset 79a3aff60e37 by Martin Panter in branch 'default':
Issue #24314: Merge doc links from 3.5
https://hg.python.org/cpython/rev/79a3aff60e37
msg268778 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-18 09:04
I also backported most of my changes to 2.7, although __name__ wasn’t originally linking to anything at all there.
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68502
2016-06-18 09:04:44martin.pantersetstatus: open -> closed
versions: - Python 3.4
messages: + msg268778

resolution: fixed
stage: patch review -> resolved
2016-06-18 08:23:15python-devsetnosy: + python-dev
messages: + msg268776
2015-05-29 04:12:12martin.pantersetfiles: + special-attr.patch

nosy: + martin.panter
messages: + msg244358

keywords: + patch
stage: patch review
2015-05-28 14:27:14julycreate