[Twisted-Python] Interface Inheritance (Ha ha METACLASS)

from twisted.python.components import Interface class InterfaceImplementor(type): def __new__(klass, name, bases, dict): realBases = [] faceBases = [] for b in bases: if isinstance(b, Interface): faceBases.append(b) elif hasattr(b, '__implements__'): faceBases.extend(b.__implements__) else: realBases.append(b) dict['__implement__'] = tuple(faceBases) return type.__new__(klass, name, realBases, dict) Inspired by fzZzy ;) Jp -- "There is no reason for any individual to have a computer in their home." -- Ken Olson, President of DEC, World Future Society Convention, 1977 -- up 6 days, 21:59, 4 users, load average: 0.52, 0.41, 0.19
participants (1)
-
Jp Calderone