The abc module extends Python’s built-in abc module with a few additional operations. For convenience, this module re-exports the bindings from the built-in abc.
>>> from md.abc import *
A class decorator for declaring that the ABC being defined is already implemented by subclasses. This is a shortcut for calling the register() method repeatedly.
>>> from numbers import Number
>>> @registers(type(None), basestring, Number, tuple)
... class Immutable(object):
... __metaclass__ = ABCMeta
>>> issubclass(tuple, Immutable)
True
A class decorator declaring that the class being defined implements one or more ABCs. This is useful when you want to register a new concrete class with an ABC, but don’t want to inherit from it directly.
>>> class SpecialType(type):
... ## Custom logic here
... pass
>>> @implements(Immutable)
... class special(object):
... __metaclass__ = SpecialType
>>> issubclass(special, Immutable)
True