summaryrefslogtreecommitdiffstats
path: root/Lib/abc.py
diff options
context:
space:
mode:
authorRam Rachum <ram@rachum.com>2021-06-27 18:02:23 (GMT)
committerGitHub <noreply@github.com>2021-06-27 18:02:23 (GMT)
commit74d60eab558bffdf5ca8ea2f5305e19b36bdb9a8 (patch)
treee51c77d40c655263f1901e24a8ab833c7a05e980 /Lib/abc.py
parent107a2c59c91b3911bdd6dfdb83271c588c506a5a (diff)
downloadcpython-74d60eab558bffdf5ca8ea2f5305e19b36bdb9a8.zip
cpython-74d60eab558bffdf5ca8ea2f5305e19b36bdb9a8.tar.gz
cpython-74d60eab558bffdf5ca8ea2f5305e19b36bdb9a8.tar.bz2
Clarify the order of a stacked `abstractmethod` (GH-26892)
Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
Diffstat (limited to 'Lib/abc.py')
-rw-r--r--Lib/abc.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/Lib/abc.py b/Lib/abc.py
index 276ef9a..3c552ce 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -28,7 +28,14 @@ def abstractmethod(funcobj):
class abstractclassmethod(classmethod):
"""A decorator indicating abstract classmethods.
- Deprecated, use 'classmethod' with 'abstractmethod' instead.
+ Deprecated, use 'classmethod' with 'abstractmethod' instead:
+
+ class C(ABC):
+ @classmethod
+ @abstractmethod
+ def my_abstract_classmethod(cls, ...):
+ ...
+
"""
__isabstractmethod__ = True
@@ -41,7 +48,14 @@ class abstractclassmethod(classmethod):
class abstractstaticmethod(staticmethod):
"""A decorator indicating abstract staticmethods.
- Deprecated, use 'staticmethod' with 'abstractmethod' instead.
+ Deprecated, use 'staticmethod' with 'abstractmethod' instead:
+
+ class C(ABC):
+ @staticmethod
+ @abstractmethod
+ def my_abstract_staticmethod(...):
+ ...
+
"""
__isabstractmethod__ = True
@@ -54,7 +68,14 @@ class abstractstaticmethod(staticmethod):
class abstractproperty(property):
"""A decorator indicating abstract properties.
- Deprecated, use 'property' with 'abstractmethod' instead.
+ Deprecated, use 'property' with 'abstractmethod' instead:
+
+ class C(ABC):
+ @property
+ @abstractmethod
+ def my_abstract_property(self):
+ ...
+
"""
__isabstractmethod__ = True