Ionel Cristian Mărieș added the comment:

On Mon, Apr 20, 2015 at 5:08 PM, Eric Snow <rep...@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
...​

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to