<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div class="im">On Thu, Oct 8, 2009 at 7:23 PM, Brian Granger <span dir="ltr">&lt;<a href="http://ellisonbg.net" target="_blank">ellisonbg.net</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>&gt;</span> wrote:<br>
</div><div><div class="im"><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
I know this is not the zope list<br></blockquote> <br></div>You&#39;re right, it&#39;s not.  Perhaps you could send a message to the interface package development list?<br><br>    <a href="https://mail.zope.org/mailman/listinfo/interface-dev" target="_blank">https://mail.zope.org/mailman/listinfo/interface-dev</a><br>

<br></div></div></blockquote><div><br>Yes, I will do that.  I wanted to get an opinion here first from the &quot;users of zope.interface&quot; first though<br>to see if anyone else had run into these things in the wild.<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The disturbing thing is that now A (which is just an object) has been hacked on<br>
by zope.interface.  It has additional methods (__provides__, etc.) that are specific to<br>
zope.<br></blockquote></div><div><br>Why does this disturb you?  Would you feel better if it were called __zope_provides__?<br><br></div></div></blockquote><div><br>Maybe a little bit, but name collisions are a minor concern in my case...<br>
 <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Summary: If a class A is later subclassed by something B that calls zi.implements, the original class A<br>becomes infected with all the zope.interface stuff.<br></blockquote></div><div><br>A gets an additional attribute.  Its behavior doesn&#39;t change in any other way.  I don&#39;t really see what&#39;s wrong with that, unless you have a differing definition of the __provides__ attribute in your code.<br>

<br></div></div></blockquote><div><br>...but __provides__ is not exactly a &quot;plain old attribute&quot;:<br><br>* The __provides__ attribute is a descriptor that sometimes raises AttributeError even though it exists.  <br>
This is how I found all of this.  I called dir on my class and __provides__ was listed.  But <br>hasattr(cls, &#39;__provides&#39;) returned False.  I consider this to be a separate bug, but because __provides__<br>started to appear on all of my classes, I was seeing it *everywhere*.<br>
<br>* The internal implementation of __provides__ is handled by a custom __metaclass__ hook.<br>zope.interface tries to be pretty careful in not actually *using* a custom metaclass, but it <br>does set and then later remove the __metaclass__ hook.  <br>
<br>In my mind, both of these things are in the &quot;unwanted side effect&quot; category.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Is there a way to avoid this?</blockquote>
</div><div><br>Depending on what your definition of &quot;this&quot; is, there almost certainly is.  In the simplest case, you could submit a patch to zope interface.<br>
<br></div></div></blockquote><div><br>That is definitely a likely outcome of this discussion.  For now though, I was just wondering<br>if other&#39;s had run into this issue.  For now, it sounds like not.<br><br>Cheers,<br>
<br>Brian<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Doesn&#39;t this seem like a bad idea?<br></blockquote></div><div><br>No. <br></div></div>
<br>
<br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br>