Message 266149 - Python tracker

Message266149

Author ionelmc
Recipients Claudiu.Popa, belopolsky, christian.heimes, eric.snow, eryksun, ethan.furman, grahamd, ionelmc, jedwards, llllllllll, r.david.murray, rhettinger, steven.daprano, terry.reedy
Date 2016-05-23.13:46:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CANkHFr-Y2utSAPfwOEPPWYyPr-J7ohGSxuHZyqhG8_hE497B7A@mail.gmail.com>
In-reply-to <1429538905.44.0.864865200854.issue23990@psf.upfronthosting.co.za>
Content
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
...​
History
Date User Action Args
2016-05-23 13:46:51ionelmcsetrecipients: + ionelmc, rhettinger, terry.reedy, belopolsky, christian.heimes, grahamd, steven.daprano, r.david.murray, Claudiu.Popa, ethan.furman, eric.snow, eryksun, llllllllll, jedwards
2016-05-23 13:46:51ionelmclinkissue23990 messages
2016-05-23 13:46:51ionelmccreate