Repository navigation
Correct DynamicClassAttribute from function to class in types docs - #144968
Conversation
|
This PR is stale because it has been open for 30 days with no activity. |
Documentation build overview
469 files changed ·
|
|
I just noticed that sphinx developers once considered adding the Python objtype checking, but finally decided not to implement it, likely due to the consequent uncomfortable restriction for python developers: sphinx-doc/sphinx#7243 |
|
This PR is stale because it has been open for 90 days with no activity. |
There was a problem hiding this comment.
Just wondering if we could generalize this PR to include:
-Route attribute access on a class to __getattr__.
+Route attribute access on a class to :func:`~object.__getattr__`.
(...)
-class's __getattr__ method; this is done by raising AttributeError.
+class's ``__getattr__`` method; this is done by raising :exc:`AttributeError`.
(...)There was a problem hiding this comment.
Thank you for your review! I've added the requested change, but switched :func: to :meth: for object.__getattr__, which is documented as .. method:: in Doc/reference/datamodel.rst. And search under Doc/ shows :meth: is more often used than :func: ( 100 vs 5 ) for object.__xxx__. Those :func:`object.__xxx__` s do work though, I think due to that sphinx refers python objects even if objtype not matched (sphinx-doc/sphinx#7243).
|
GH-162204 is a backport of this pull request to the 3.14 branch. |
|
GH-162205 is a backport of this pull request to the 3.15 branch. |
The documentation incorrectly labeled
DynamicClassAttributeas a function, which misrepresents its actual type.As this is a documentation change, I didn't add a news entry. I will create an issue if needed.
📚 Documentation preview 📚: https://cpython-previews--144968.org.readthedocs.build/