Back to index

python3.2  3.2.2
Classes | Functions
abc Namespace Reference

Classes

class  abstractclassmethod
class  abstractstaticmethod
class  abstractproperty
class  ABCMeta

Functions

def abstractmethod

Function Documentation

def abc.abstractmethod (   funcobj)
A decorator indicating abstract methods.

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 methods are overridden.
The abstract methods can be called using any of the normal
'super' call mechanisms.

Usage:

    class C(metaclass=ABCMeta):
        @abstractmethod
        def my_abstract_method(self, ...):
            ...

Definition at line 8 of file abc.py.

00008 
00009 def abstractmethod(funcobj):
00010     """A decorator indicating abstract methods.
00011 
00012     Requires that the metaclass is ABCMeta or derived from it.  A
00013     class that has a metaclass derived from ABCMeta cannot be
00014     instantiated unless all of its abstract methods are overridden.
00015     The abstract methods can be called using any of the normal
00016     'super' call mechanisms.
00017 
00018     Usage:
00019 
00020         class C(metaclass=ABCMeta):
00021             @abstractmethod
00022             def my_abstract_method(self, ...):
00023                 ...
00024     """
00025     funcobj.__isabstractmethod__ = True
00026     return funcobj
00027