[Twisted-Python] Notes on switching twisted to new zope.interface code

James Y Knight foom at fuhm.net
Wed Jul 21 18:50:07 EDT 2004

On Jul 21, 2004, at 5:04 PM, Eugene Coetzee wrote:
> I am new to  Python, Twisted and Zope - so I guess I look at the world 
> through my Perlish C++ tainted goggles :)
> Just one or two comments - 30  000  feet from above.  I have noticed 
> the introduction  of Zope interfaces in other projects as well where 
> some developers are almost going bonkers with interfaces as "the new 
> best thing" and where simple inheritance is being discarded in places 
> where they should really be used. Don't think that is a good thing.

One important thing to note: The zope interfaces package is not being 
used to replace inheritance (That already happened years ago). It is 
being used to replace the twisted interfaces module, which was slower 
and buggy. From my perspective the switch is an unambiguously good 
thing. The only issues are in the migration path. But that's mostly 
worked out now thanks to itamar.

Just in case what itamar said was too lengthy, here's the shortened 

First -- all your old code *will continue to work with no changes*. 
However, to eliminate DeprecationWarnings and cause your code to be 
faster, make the following change:

   twisted.python.components.implements(o, IFoo) => IFoo.providedBy(o)
   class X(): __implements__ = IFoo, => class X(): 

If you are modifying code in Twisted itself, you have to do slightly 
more, so that 3rd party classes relying on __implements__ to work will 
continue to function:

   twisted.python.components.implements(o, IFoo) => 

   class X(): __implements__ = IFoo, => class X(): 


More information about the Twisted-Python mailing list