Message53363
Logged In: YES
user_id=31435
FYI, ZODB has a WeakSet implementation, in utils.py here:
http://svn.zope.org/ZODB/trunk/src/ZODB/
I wouldn't add this to the core -- it's very specific to ZODB's
needs. For example, it actually uses a weak value
dictionary, because ZODB can't assume the set elements
are usably comparable or hashable.
One thing that "should be" addressed in the core is explained
in a long comment there: the core weak containers don't
supply a sane way to iterate over their weakly referenced
containees. You either risk unpredictable "dict changed size
during iteration" exceptions, or unboundedly worse gc
behavior (read the comment for more detail). The ZODB
WeakSet implementation has to break into the weak-value
dict implementation to supply a partially sane way to iterate
over its elements ("partially" means it's not incremental, and
exposes weakrefs to the client; OTOH, it doesn't suffer
mystery "dict changed size" exceptions, and plays nicely
with gc). |
|
Date |
User |
Action |
Args |
2007-08-23 16:01:48 | admin | link | issue487738 messages |
2007-08-23 16:01:48 | admin | create | |
|