[Twisted-Python] Interfaces

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Apr 17 04:10:06 EDT 2003

Hash: SHA1

On Wednesday, April 16, 2003, at 10:27 PM, Christopher Armstrong wrote:

> I like Interface inheritance, and I don't think anyone has really 
> objected to
> it yet.

I have :-).

The problem is that currently, it doesn't do what you think.  What most 
people want an interface inheritance to do is make

     class IFoo(Interface): pass
     class IBar(IFoo): pass
     class Bar:
         __implements__ = IBar

be more or less equivalent to

     class IFoo(Interface): pass
     class IBar(Interface): pass
     class Bar:
         __implements__ = IFoo, IBar

Currently this does _not_ happen, because

Does this "DWIM" in Zope?  I have been hesitant to make 
python.components handle it this way, firstly because we didn't realize 
it at first and so it would now be a change in semantics, and secondly 
because it's not clear what effect this would have on registerAdapter.  

     registerAdapter(Bar, Baz, IBar)

also register an adapter for Baz for IFoo?  Why or why not?  What if a 
different adapter was already registered?  I could see that taking 
interface inheritance into account here could be sometimes convenient, 
but it could also be sometimes wrong.  I really have no idea what the 
right answer is, and so leaving it "inconvenient but simple" was easier 
for the time being.
Version: GnuPG v1.2.1 (Darwin)


More information about the Twisted-Python mailing list