[PEAK] Status of PyProtocols

P.J. Eby pje at telecommunity.com
Fri Mar 18 15:10:16 EDT 2011

At 06:12 PM 3/18/2011 +0800, Michael Milverton wrote:
>Hi, I love PyProtocols and have used it since about 2005, but since 
>it hasn't been updated in a while I'm kind of curious as to what 
>it's future holds. I am a little hesitant to use it in code now 
>because I'm worried that PyProtocols doesn't have a future.

It really doesn't.  Twisted's old interface system has died and been 
replaced with zope.interface, and the interface/adaptation PEPs are 
just as dead.  Python since 2.6 is using the 'abc' module for 
interface declaration, and PyProtocols doesn't have any support for it.

PEAK-Rules, on the other hand, *does* support ABCs, and the 
combination of abcs, generic functions, and add-ons (see the AddOns 
project on PyPI) can do pretty much anything you could do with 
PyProtocols (except interoperate directly with zope.interface).

About the only thing that's lacking is the ability to actually 
"adapt" something to something else; I do plan to add a generic 
Interface class to support this at some point, but that's really just 
syntax sugar.

If you write an interface like this today:

   class IFoo(abc):
       def some_method(self, blah, blah):

Then you can simply say:

     IFoo.some_method(anObj, ...)

instead of:


And in an implementation, you simply say:

     class Foo:
         def some_method(self, blah, blah):

to register your implementation.

In other words, It's really only if you're trying to be backward 
compatible with a large code base that you need the additional syntax sugar.

>  Also, would it be hard to remove the speedup setup and just have a 
> pure python implementation?

No, it's optional.  At runtime, if the C code can't be imported, the 
Python code is used in its place.

More information about the PEAK mailing list