[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC: Proposal: Deterministic Object Destruction

Richard Damon <Richard at Damon-Family.org> writes:

> [?] I can't see any good way to create the equivalent of a 'weak
> reference' (names aren't objects so don't have properties). The? best
> I can think of is to create some sort of magical object that can refer
> to another object, but that reference 'doesn't count'. This seems very
> unPythonic.

Do you mean something like the standard library ?weakref? module

    The weakref module allows the Python programmer to create weak
    references to objects.

    A weak reference to an object is not enough to keep the object
    alive: when the only remaining references to a referent are weak
    references, garbage collection is free to destroy the referent and
    reuse its memory for something else. However, until the object is
    actually destroyed the weak reference may return the object even if
    there are no strong references to it.

 \           ?The cost of education is trivial compared to the cost of |
  `\                                     ignorance.? ?Thomas Jefferson |
_o__)                                                                  |
Ben Finney