[Python-Dev] Anyone using weakrefs?

Martin von Loewis loewis at informatik.hu-berlin.de
Sat Mar 24 07:19:20 EST 2001


"Fredrik Lundh" <fredrik at pythonware.com> writes:

> am I the only one who gets a bit nervous when the guy who
> designed and implemented a feature has a hard time finding a
> non-contrived use case? ;-)

Seriously (and not knowing the exact meaning of contrived), a good
application is the parent link in a DOM tree. The problem is that this
is 
a) probably a too complex example for the documentation, as just
   making parent weak is not enough - ownerDoc also needs to be weak,
   and,
b) nobody has changed any DOM implementation to make use weak
   references; Fred was asking for a real application.

Regards,
Martin

P.S. I've considered using weakrefs in minidom, but put that plan
aside since that would break portability with 1.5.



More information about the Python-list mailing list