Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index e6c327d..4cd6590 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -697,8 +697,9 @@
To declare a class method, use this idiom:
class C:
- def f(cls, arg1, arg2, ...): ...
- f = classmethod(f)
+ @classmethod
+ def f(cls, arg1, arg2, ...):
+ ...
It can be called either on the class (e.g. C.f()) or on an instance
(e.g. C().f()); the instance is ignored except for its class.
@@ -808,8 +809,9 @@
To declare a class method, use this idiom:\n\
\n\
class C:\n\
- def f(cls, arg1, arg2, ...): ...\n\
- f = classmethod(f)\n\
+ @classmethod\n\
+ def f(cls, arg1, arg2, ...):\n\
+ ...\n\
\n\
It can be called either on the class (e.g. C.f()) or on an instance\n\
(e.g. C().f()). The instance is ignored except for its class.\n\
@@ -880,8 +882,9 @@
To declare a static method, use this idiom:
class C:
- def f(arg1, arg2, ...): ...
- f = staticmethod(f)
+ @staticmethod
+ def f(arg1, arg2, ...):
+ ...
It can be called either on the class (e.g. C.f()) or on an instance
(e.g. C().f()); the instance is ignored except for its class.
@@ -986,8 +989,9 @@
To declare a static method, use this idiom:\n\
\n\
class C:\n\
- def f(arg1, arg2, ...): ...\n\
- f = staticmethod(f)\n\
+ @staticmethod\n\
+ def f(arg1, arg2, ...):\n\
+ ...\n\
\n\
It can be called either on the class (e.g. C.f()) or on an instance\n\
(e.g. C().f()). The instance is ignored except for its class.\n\