[Zope] Re: [Python-Help] Overrinding a method which doesn't belong to a class

Alex Martelli aleaxit@yahoo.com
Mon, 16 Jul 2001 15:52:48 +0200


"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