abc.abstractproperty¶
-
class
abc.abstractproperty[source]¶ 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 instantiated unless all of its abstract properties are overridden. The abstract properties can be called using any of the normal ‘super’ call mechanisms.
Usage:
- class C:
__metaclass__ = ABCMeta @abstractproperty def my_abstract_property(self):
...
This defines a read-only property; you can also define a read-write abstract property using the ‘long’ form of property declaration:
- class C:
- __metaclass__ = ABCMeta def getx(self): ... def setx(self, value): ... x = abstractproperty(getx, setx)
Methods¶
__format__ |
default object formatter |
__new__((S, ...) |
|
__reduce__ |
helper for pickle |
__reduce_ex__ |
helper for pickle |
__sizeof__(() -> int) |
size of object in memory, in bytes |
__subclasshook__ |
Abstract classes can override this to customize issubclass(). |
deleter |
Descriptor to change the deleter on a property. |
getter |
Descriptor to change the getter on a property. |
setter |
Descriptor to change the setter on a property. |