[Interface-dev] Re: Twisted switch progress report

Philipp von Weitershausen philipp at weitershausen.de
Mon May 10 13:15:35 EDT 2004


Itamar Shtull-Trauring wrote:
> Looks like we can switch to zope.interface in Twisted once we get past
> v1.3 release this week.
> 
> 1. We will use zope.components' registry adapter if it's available,
> otherwise create our own (transparent to users, of course) so there's
> always only one global registry.
> 
> 2. We will install zope.interface ourselves, using Fred Drake's
> distutils infrastructure probably (assuming you use tarball. Debian
> packages will hopefully do something more reasonable). The only issue
> here is API stability - we can't switch until we have assurance of this.
> 
> 3. Currently implements is indicated like this:
> 
> class Bar:
>    __implements__ = IFoo, IBar
> 
> I have some code in adapter registration backwards compat layer that
> converts this to the correct way. The problem is with subclasses:
> 
> class Sub(Bar):
>    __implements__ = Bar.__implements__ + (ISub,)
> 
> If Bar changes to implements(), Sub will break. In the interest of
> backwards compat, could I change the implements() class' __add__ and
> __radd__ to handle tuples and interface objects? With a deprecation
> warning of course.

Martijn Faassen changed the zope.interface package to use 
__implemented__ instead of __implements__ in a branch 
(faassen-interfaces-branch or so), in order to avoid the same backward 
compat clash with Zope2 interfaces. The plan is to merge that branch soon.

When using old-style interfaces, you would use __implements__ = ..., 
when using new-style ones, you'd use implements(). That way, Zope2 and 
Zope3 interface declarations and lookups are completely independant of 
each other, which is the best way to make them cooperate, really. :)

For more information, see the corresponding thread on zope3-dev.

Philipp




More information about the Interface-dev mailing list