Out of curiosity, I've noticed the word "evil" attached to patching of various and monkey kinds. Not "bad", or "unwise", but "evil", implying a morality associated with the act.
What is morally wrong with modifying live objects in a dynamic language to achieve desired functionality? The idea is "I want to modify the zope core in a way that survives version to version, yet does not impose a specific use case on all zope users". -----Original Message----- From: Tino Wildenhain [mailto:[EMAIL PROTECTED] Sent: Friday, May 20, 2005 2:38 PM To: Dan Pozmanter Cc: Andreas Jung; [email protected] Subject: RE: [Zope] Modifying __bases__ Am Freitag, den 20.05.2005, 13:48 -0400 schrieb Dan Pozmanter: > Well, when I run it, I am able to do the following: > > ------------------------------------ > class A: > pass > > class B(A): > pass > > b = B() > > B.__bases__ = () > > print B.__bases__ > ------------------------------------ > > Not so on the version that comes with zope. > (B.__bases__ will remain unchanged.) > > What I aim to do is have the User Object inherit from a custom class > (AlienUser). Well, you can just inherit with a class from zopes extension classes. You cannot modify the class bases like this with extension classes. You can work around that like I did with the history (monkey) patch: http://www.zope.org/Members/tino/PatchHistory/view Otherwise it sounds evil and you failed to show the true motivation with your example above. Tino. PS: Votes for a true implementation in current zope instead of the monkey patch? If so, tell me. _______________________________________________ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
