At Thursday 5/10/2006 13:53, [EMAIL PROTECTED] wrote:
Has anyone ever think about a set wich references its elements weakly ?
The *easy* solution would provide a WeakSet class with the following
behavior:
>>>s=set([a, b])
>>>ws=WeakSet([b,c])
>>>(ws&s).__class__() is WeakSet
True
>>>s&ws
TypeErr
[EMAIL PROTECTED]
> Has anyone ever think about a set wich references its elements weakly ?
Yes, and there are excruciating subtleties. I only implemented as
much of one as ZODB needed at the time:
# A simple implementation of weak sets, supplying just enough of Python's
# sets.Set interface for