Overrinding a method which doesn't belong to a class
Hi ! I am trying to override a method that doesn't belong to a class. I am doing : """ from module import manage_addSomething def my_own(..): self... import module module.manage_addSomething = my_own """ Any hints ? ___________________________________________________________ Do You Yahoo!? -- Vos albums photos en ligne, Yahoo! Photos : http://fr.photos.yahoo.com
"Valérie Aulnette" <vaulnette@yahoo.fr> writes: ...
I am trying to override a method that doesn't belong to a class. I am doing :
Apparently, then, not a method, but a function.
""" from module import manage_addSomething
def my_own(..): self...
import module module.manage_addSomething = my_own """
Any hints ?
Functions don't normally have any special "self" parameter, yet you seem to be using one in your my_own function. Apart from that, this seems OK: if your my_own function works OK, there is no problem with you re-binding the attribute named 'manage_addSomething' in module 'module' so that it refers to my_own rather than to whatever it used to refer-to previously. Alex
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Valérie Aulnette
I am trying to override a method that doesn't belong to a class. I am doing :
""" from module import manage_addSomething
def my_own(..): self...
import module module.manage_addSomething = my_own """
Why not just: manage_addSomething = my_own Or is it a special case? regards Max M Max M. W. Rasmussen, Denmark. New Media Director private: maxmcorp@worldonline.dk work: maxm@normik.dk ----------------------------------------------------- Shipping software is an unnatural act
participants (3)
-
Alex Martelli -
Max M -
Valérie Aulnette