[Twisted-Python] Interface Inheritance (Ha ha METACLASS)
    Jp Calderone 
    exarkun at intarweb.us
       
    Wed Mar 26 18:34:43 MST 2003
    
    
  
    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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20030326/e600c1d8/attachment.sig>
    
    
More information about the Twisted-Python
mailing list