Closed blankjul closed 1 year ago
Yes that is how it works. It is not inheritance, it is wrapping the inner object, so the inner object knows nothing about what it is wrapped by.
Sounds like you want normal class inheritance.
Thank you for your quick answer. I want something close to class inheritance but based on an object.
Let us say I have an instance p
of a class P
. Then, I would like to wrap the object, let us say with class Q
by doing Q(p)
where I would like to overwrite only a few methods and potentially implement some new ones.
Any recommendation on how to achieve that? (originally I thought the ObjectProxy
will do exactly that for me).
You shouldn't be using an object wrapper then. You should be monkey patching the original object instance.
Watch:
Did you come up with a solution for this?
I found an entirely different solution. The issue can be closed.
Thank you for this great framework! I am trying to use the
ObjectProxy
to overwrite a method of an object. It works perfectly if the method is called from the outside. However, calling it throughself
does still cause the old method to be called.Please see the following Minimum Working Example (MWO) below:
I was wondering if this behavior is desired? I was expecting since the
value
function should be overwritten that both result infrom MyProxy
. Any ideas on how to change this behavior of the proxy?Thank you in advance!