@@ -11,7 +11,8 @@ def abstractmethod(funcobj):
11
11
class that has a metaclass derived from ABCMeta cannot be
12
12
instantiated unless all of its abstract methods are overridden.
13
13
The abstract methods can be called using any of the normal
14
- 'super' call mechanisms.
14
+ 'super' call mechanisms. abstractmethod() may be used to declare
15
+ abstract methods for properties and descriptors.
15
16
16
17
Usage:
17
18
@@ -27,17 +28,7 @@ def my_abstract_method(self, ...):
27
28
class abstractclassmethod (classmethod ):
28
29
"""A decorator indicating abstract classmethods.
29
30
30
- Similar to abstractmethod.
31
-
32
- Usage:
33
-
34
- class C(metaclass=ABCMeta):
35
- @abstractclassmethod
36
- def my_abstract_classmethod(cls, ...):
37
- ...
38
-
39
- 'abstractclassmethod' is deprecated. Use 'classmethod' with
40
- 'abstractmethod' instead.
31
+ Deprecated, use 'classmethod' with 'abstractmethod' instead.
41
32
"""
42
33
43
34
__isabstractmethod__ = True
@@ -50,17 +41,7 @@ def __init__(self, callable):
50
41
class abstractstaticmethod (staticmethod ):
51
42
"""A decorator indicating abstract staticmethods.
52
43
53
- Similar to abstractmethod.
54
-
55
- Usage:
56
-
57
- class C(metaclass=ABCMeta):
58
- @abstractstaticmethod
59
- def my_abstract_staticmethod(...):
60
- ...
61
-
62
- 'abstractstaticmethod' is deprecated. Use 'staticmethod' with
63
- 'abstractmethod' instead.
44
+ Deprecated, use 'staticmethod' with 'abstractmethod' instead.
64
45
"""
65
46
66
47
__isabstractmethod__ = True
@@ -73,29 +54,7 @@ def __init__(self, callable):
73
54
class abstractproperty (property ):
74
55
"""A decorator indicating abstract properties.
75
56
76
- Requires that the metaclass is ABCMeta or derived from it. A
77
- class that has a metaclass derived from ABCMeta cannot be
78
- instantiated unless all of its abstract properties are overridden.
79
- The abstract properties can be called using any of the normal
80
- 'super' call mechanisms.
81
-
82
- Usage:
83
-
84
- class C(metaclass=ABCMeta):
85
- @abstractproperty
86
- def my_abstract_property(self):
87
- ...
88
-
89
- This defines a read-only property; you can also define a read-write
90
- abstract property using the 'long' form of property declaration:
91
-
92
- class C(metaclass=ABCMeta):
93
- def getx(self): ...
94
- def setx(self, value): ...
95
- x = abstractproperty(getx, setx)
96
-
97
- 'abstractproperty' is deprecated. Use 'property' with 'abstractmethod'
98
- instead.
57
+ Deprecated, use 'property' with 'abstractmethod' instead.
99
58
"""
100
59
101
60
__isabstractmethod__ = True
0 commit comments