diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-12-15 20:34:02 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-12-15 20:34:02 (GMT) |
commit | bfebb7b54a50f01104f7b6169de77f7fc8feb912 (patch) | |
tree | ef88caf96404fbb445d25a695eaa8e51bc750566 /Lib/abc.py | |
parent | a8ff01ca7422117dcd906ee2ea55c5293eeceb24 (diff) | |
download | cpython-bfebb7b54a50f01104f7b6169de77f7fc8feb912.zip cpython-bfebb7b54a50f01104f7b6169de77f7fc8feb912.tar.gz cpython-bfebb7b54a50f01104f7b6169de77f7fc8feb912.tar.bz2 |
improve abstract property support (closes #11610)
Thanks to Darren Dale for patch.
Diffstat (limited to 'Lib/abc.py')
-rw-r--r-- | Lib/abc.py | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -26,7 +26,8 @@ def abstractmethod(funcobj): class abstractclassmethod(classmethod): - """A decorator indicating abstract classmethods. + """ + A decorator indicating abstract classmethods. Similar to abstractmethod. @@ -36,6 +37,9 @@ class abstractclassmethod(classmethod): @abstractclassmethod def my_abstract_classmethod(cls, ...): ... + + 'abstractclassmethod' is deprecated. Use 'classmethod' with + 'abstractmethod' instead. """ __isabstractmethod__ = True @@ -46,7 +50,8 @@ class abstractclassmethod(classmethod): class abstractstaticmethod(staticmethod): - """A decorator indicating abstract staticmethods. + """ + A decorator indicating abstract staticmethods. Similar to abstractmethod. @@ -56,6 +61,9 @@ class abstractstaticmethod(staticmethod): @abstractstaticmethod def my_abstract_staticmethod(...): ... + + 'abstractstaticmethod' is deprecated. Use 'staticmethod' with + 'abstractmethod' instead. """ __isabstractmethod__ = True @@ -66,7 +74,8 @@ class abstractstaticmethod(staticmethod): class abstractproperty(property): - """A decorator indicating abstract properties. + """ + A decorator indicating abstract properties. Requires that the metaclass is ABCMeta or derived from it. A class that has a metaclass derived from ABCMeta cannot be @@ -88,7 +97,11 @@ class abstractproperty(property): def getx(self): ... def setx(self, value): ... x = abstractproperty(getx, setx) + + 'abstractproperty' is deprecated. Use 'property' with 'abstractmethod' + instead. """ + __isabstractmethod__ = True |