[PEAK] protocols question

Phillip J. Eby pje at telecommunity.com
Fri Feb 17 12:57:34 EST 2006


At 05:40 PM 02/17/2006 +0200, Vladimir Iliev wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hi,
>zope.interface's interfaces has isOrExtends() method. Is there such
>thing in PyProtocols?

I don't remember; I've not needed such a thing to my 
recollection.  PyProtocols doesn't pay attention to extending; it pays 
attention to *implication* (which can only be done in Zope via extending).

My guess is that if you *need* to know this, you're doing something 
wrong.  The whole point of PyProtocols is to not need to know stuff like 
that; the system knows and takes care of it for you.  Introspection is 
evil.  Code should be written so it doesn't care what interface something 
has: just adapt to the interface you *want*, and forget about it.

(If you really really need to know this, Protocol objects have a 
getImpliedInterfaces() method and you can look if something's in it, but 
it's going to be dog-slow because it wasn't designed for this; it's 
designed to adapt things fast, not to do introspection, which as I said, is 
evil.  :) )




More information about the PEAK mailing list