RFC: Proposal: Deterministic Object Destruction (Posting On Python-List Prohibited)

Gregory Ewing greg.ewing at canterbury.ac.nz
Sat Mar 3 21:13:41 EST 2018


Paul Rubin wrote:
> Richard Damon <Richard at Damon-Family.org> writes:
> 
>>a class to define member functions like __ref__
>>and __unref__ (or perhaps some other name) that if defined, would be
>>called every time a name was bound or unbound to an object?
> 
> That sounds horrendous and wouldn't handle the case of a list element
> creating a reference without binding a name.

To be any use, they would have to be called any time the
reference count changes, which happens *very* frequently --
so massive overhead.

There's also a logical problem. Calling __ref__  would
itself involve adding at least one reference to the object
temporarily, thus requiring __ref__ to be called, which
would...

-- 
Greg



More information about the Python-list mailing list