[Python-ideas] Weak-referencing/weak-proxying of (bound) methods

shibturn shibturn at gmail.com
Fri Jun 15 15:01:23 CEST 2012

On 15/06/2012 1:41pm, Tal Einat wrote:
> I was bitten by this issue a while ago as well. It made working with
> weakref proxies much more involved than I expected it would be.
> Wouldn't it be better to approach the issue from the opposite end, and
> improve/wrap/replace weakref.proxy with something that can handle bound
> methods?

Maybe just add something like the following to weakref:

def weakboundmethod(m):
     return m.__func__.__get__(weakref.proxy(m.__self__),



More information about the Python-ideas mailing list