https://github.com/python/cpython/commit/c2080532a0ebd637ecf2f55fc65143b61c9c6cfb commit: c2080532a0ebd637ecf2f55fc65143b61c9c6cfb branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: encukou <[email protected]> date: 2026-11-18T13:04:56+01:00 summary:
[3.15] Correct `DynamicClassAttribute` from function to class in types docs (GH-144968) (GH-162205) Also: add sphinx roles to the text (cherry picked from commit b219e551e86bc1a78d09bb246880ed9fb3839678) Co-authored-by: Tan Long <[email protected]> files: M Doc/library/types.rst diff --git a/Doc/library/types.rst b/Doc/library/types.rst index 9e928e6dd3637b..7a6e7aa3fae6a5 100644 --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -515,14 +515,14 @@ Additional Utility Classes and Functions .. versionchanged:: 3.13 Added support for an optional positional argument. -.. function:: DynamicClassAttribute(fget=None, fset=None, fdel=None, doc=None) +.. class:: DynamicClassAttribute(fget=None, fset=None, fdel=None, doc=None) - Route attribute access on a class to __getattr__. + Route attribute access on a class to :meth:`~object.__getattr__`. This is a descriptor, used to define attributes that act differently when accessed through an instance and through a class. Instance access remains normal, but access to an attribute through a class will be routed to the - class's __getattr__ method; this is done by raising AttributeError. + class's ``__getattr__`` method; this is done by raising :exc:`AttributeError`. This allows one to have properties active on an instance, and have virtual attributes on the class with the same name (see :class:`enum.Enum` for an example). _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
