This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2005-07-27.18:00:51
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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).
History
Date User Action Args
2007-08-23 16:01:48adminlinkissue487738 messages
2007-08-23 16:01:48admincreate