[Python-Dev] Weak references
Sun, 5 Nov 2000 23:06:35 -0500
Fred L. Drake, Jr. [email@example.com] wrote:
> Guido van Rossum writes:
> > Yes, definitely. Weak dicts are sometimes needed for situations where
> > a regular dict would keep objects alive forever. E.g. we were made
> > aware of a "leak" in JPython that could only be fixed with weak dicts:
> > the Swing wrapper code has a global dict mapping widgets to callback
> That's a perfect example. I've started working on some text
> describing the motivation; hopefully I'll have that fleshed out and
> checked in later this week.
Another example is some of the things in Zope use back-references for
ease of traversability (or worse keep weird counts hanging around).
Alot of these are negated by ZODB's ability to break cycles, but... a
lot of data structures would be hugely better from an architecture
perspective if we had a native weak reference.
| Christopher Petrilli