[Python-3000] Weakref protocol? (Re: weakrefs of bound methods)
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Feb 16 01:26:41 CET 2008
Phillip J. Eby wrote:
> So, Nick's query is (in effect), can we either:
>
> 1. make ref(method) create a "weak method" instead, or
>
> 2. make ref(method) an error instead of useless behavior that gives
> you the illusion of working code
Maybe what we want here is a weakref protocol. So instead
of weakref() directly creating a weak ref object, it would
call __weakref__ on its argument.
Most objects would respond by creating a standard weak
ref object, but special cases such as bound methods
could do something different.
--
Greg
More information about the Python-3000
mailing list