Server!/Horror! I have a magnet and I don't mind using it!

Python and "Interfaces" (Abstract Base Classes)

import sys
import os
from abc import ABCMeta
from abc import abstractmethod


class MetaClass:
    __metaclass__ = ABCMeta
    @abstractmethod
    def needs_implementation(self):
        pass


class ImplementationClassOK(MetaClass):
    def random_method(self):
        pass
    def needs_implementation(self):
        pass


class ImplementationClassFail(MetaClass):
    def random_method(self):
        pass


if __name__ == u'__main__':
    print u'Type OK: ', type(ImplementationClassOK)
    ok = ImplementationClassOK()
    print u'Type Instance OK: ', type(ok)
    print ok
    print type(ImplementationClassFail)
    try:
        print u'Type FAIL: ', type(ImplementationClassFail)
        fail = ImplementationClassFail()
        print u'Type Instance FAIL: ', type(fail)
        print fail
    except (TypeError, ) as error:
        print error
        raise

Generated: 2017-11-02 10:20:47 +0100