How to change class instances behavior via reload?
Laurent Szyster
l.szyster at ibm.net
Mon Jun 26 03:40:21 EDT 2000
Jerome Quelin wrote:
>
> I would like to change the behavior of all the existing instances
> of a class when using the reload statement. I wonder if this is
> possible?
No. You should implement static and dynamic features that you need
in different modules and use proxy methods.
Like this
-- dtest.py --
def method(self):
...
-- test.py --
class test:
def method(self):
return dtest.method(self)
And then,
>>> import test, dtest
>>> t = test.test()
>>> reload(dtest)
>>> t.method()
Laurent Szyster
More information about the Python-list
mailing list