[Twisted-Python] Components

Phillip J. Eby pje at telecommunity.com
Thu Feb 26 14:59:35 EST 2004

At 02:43 PM 2/26/04 -0500, Bob Ippolito wrote:

>How about just migrating off of t.p.components and switching to 
>PyProtocols?  The license is compatible, it has PEP-backing, it is a 
>superset of what t.p.components does, has optional Pyrex acceleration, and 
>is compatible with Interfaces from itself, t.p.components, and 
>zope.components.  The default Interface implementation does not support 
>the __call__ adaptation that we all know and love, but it is actually 
>generic enough to allow it.

Yep, just subclass InterfaceClass and add a __call__ method that calls back 
to adapt() and you'd be all set.  One other benefit to PyProtocols is that 
you can track what interfaces an *instance* supports, independent of what 
its class supports.

The more controversial aspect, however, is transitive adaptation.  IIRC, 
some of the core Twisted developers consider implicit transitive adaptation 
to be dangerous and/or evil.  However, that could possibly also be dealt 
with in a protocols.Interface subclass by disabling the parts that support 

There might be some other issues that could come up, but I'm definitely 
willing to try to "adapt" to Twisted's needs in these areas, especially if 
it means I could get rid of PyProtocols' wrapper code and wrapping tests 
for Twisted's existing interface class.  :)

More information about the Twisted-Python mailing list