Browse Source
bpo-43682: @staticmethod inherits attributes (GH-25268)
bpo-43682: @staticmethod inherits attributes (GH-25268)
Static methods (@staticmethod) and class methods (@classmethod) now inherit the method attributes (__module__, __name__, __qualname__, __doc__, __annotations__) and have a new __wrapped__ attribute. Changes: * Add a repr() method to staticmethod and classmethod types. * Add tests on the @classmethod decorator.pull/25319/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 133 additions and 22 deletions
-
10Doc/library/functions.rst
-
6Doc/whatsnew/3.10.rst
-
26Lib/test/test_decorators.py
-
18Lib/test/test_descr.py
-
6Lib/test/test_pydoc.py
-
4Lib/test/test_reprlib.py
-
5Misc/NEWS.d/next/Core and Builtins/2021-04-08-01-06-22.bpo-43682.eUn4p5.rst
-
80Objects/funcobject.c
@ -0,0 +1,5 @@ |
|||
Static methods (:func:`@staticmethod <staticmethod>`) and class methods |
|||
(:func:`@classmethod <classmethod>`) now inherit the method attributes |
|||
(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``, |
|||
``__annotations__``) and have a new ``__wrapped__`` attribute. |
|||
Patch by Victor Stinner. |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue