N
Nikolaus Rath
Hi,
I want to monkeypatch an object so that it becomes callable, although
originally it is not meant to be. (Yes, I think I do have a good reason
to do so).
But simply adding a __call__ attribute to the object apparently isn't
enough, and I do not want to touch the class object (since it would
modify all the instances):
.... pass
.... .... print 'bar'
.... Traceback (most recent call last):
Traceback (most recent call last):
bar
Is there an additional trick to get it to work?
Best,
-Nikolaus
I want to monkeypatch an object so that it becomes callable, although
originally it is not meant to be. (Yes, I think I do have a good reason
to do so).
But simply adding a __call__ attribute to the object apparently isn't
enough, and I do not want to touch the class object (since it would
modify all the instances):
.... pass
.... .... print 'bar'
.... Traceback (most recent call last):
Traceback (most recent call last):
bar
Is there an additional trick to get it to work?
Best,
-Nikolaus