On Mon, Apr 20, 2015 at 5:08 PM, Eric Snow <report@bugs.python.org> wrote:
> FYI, I'll re-iterate something I said before, there is a different
> approach you can take here if this is just an issue of proxying. Use two
> different proxy types depending on if the proxied object is callable or not:
>
>
> class Proxy:
> # all the proxy stuff...
>
>
> class CallableProxy(Proxy):
> def __call__(self, *args, **kwargs):
> ...
>
>
> def proxy(obj):
> if callable(obj):
> return CallableProxy(obj)
> else:
> return Proxy(obj)
>
>
> If that isn't a viable alternative then please explain your use case in
> more detail. I'm sure we can find a solution that works for you.
>
This does not work if I need to resolve the `obj` at a later time (way
later than the time I create the Proxy object). Unfortunately, I need
exactly that. Not sure how that wasn't clear from all the examples I posted
... |