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:tino@wildenhain.de] Sent: Friday, May 20, 2005 2:38 PM To: Dan Pozmanter Cc: Andreas Jung; zope@zope.org 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.