[Twisted-Python] Re: Notes on switching twisted to new zope.interface code
Andrew Bennetts
andrew-twisted at puzzling.org
Mon Jul 19 01:43:21 EDT 2004
On Mon, Jul 19, 2004 at 01:26:42AM -0400, Alex Levy wrote:
[...]
>
> What about subclasses?
>
> class C:
> __implements__ = IFoo,
>
> class D(C):
> __implements__ = (C.__implements__, IFoo)
>
> Do Zope interfaces need anything special to handle this?
(Did you really mean to use IFoo twice in your example?)
See the Zope interfaces package documentation for details, but this:
class C:
__implements__ = (IFoo,)
class D:
__implements__ = (C.__implements__, IBar)
would become this:
from zope.interface import implements
class C:
implements(IFoo)
class D:
implements(IBar)
i.e. implements adds to the list of interfaces the class implements.
There's also an "implementsOnly" function.
See README.txt from the zope.interface package for more details:
http://svn.zope.org/Zope3/trunk/src/zope/interface/README.txt?rev=13888&view=auto
-Andrew.
More information about the Twisted-Python
mailing list