Hi, I know this is not the zope list, but I am encountering this in a twisted project, so I wanted to get some ideas here first. I am finding that zope.interface is like an infectious disease. Here is a simple example:
In [35]: import zope.interface as zi In [37]: class A(object): ....: pass In [38]: class IB(zi.Interface): ....: pass In [39]: hasattr(A, '__provides__') Out[39]: False In [41]: # Inheriting from A gives A additional methods In [42]: class B(A): ....: zi.implements(IB) In [43]: hasattr(A, '__provides__') Out[43]: True In [45]: # C is clean of the additional methods In [46]: class C(object): ....: pass In [47]: hasattr(C, '__provides__') Out[47]: False The disturbing thing is that now A (which is just an object) has been hacked on by zope.interface. It has additional methods (__provides__, etc.) that are specific to zope. Summary: If a class A is later subclassed by something B that calls zi.implements, the original class A becomes infected with all the zope.interface stuff. Is there a way to avoid this? Doesn't this seem like a bad idea? Cheers, Brian
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python