[Twisted-Python] Interface.adaptWith and Interface.__adapt__

Phillip J. Eby pje at telecommunity.com
Sat Jun 7 15:46:18 EDT 2003

At 06:51 PM 6/7/03 +0000, Clark C. Evans wrote:
>This is great that PEP 246 has found a supporter... let alone someone
>who is doing an implementation!  Anyway, I support PEP 246 being
>modified to not catch TypeError; this was done in such a way as to
>make writing adapters easier.  But alas, if setting up the try/catch
>block is causing performance problems, then it should be dropped.

The change isn't for performance reasons, but for debugging.  Jim and I 
both feel that masking users' TypeErrors is a bad idea.  So my 
implementation uses a sneaky trick to detect whether the TypeError came 
from *invoking* the method, as opposed to being from *within* the 
method.  This still lets you write simple protocols and components.

>The python community does indeed need a common protocol implementation,
>I do hope your work gains adoption.

As per my other e-mail (Re: PEP 246 comments), I certainly welcome your 
feedback on the current state of the PyProtocols API.  I expect to make a 
public release in the next day or two.

More information about the Twisted-Python mailing list