weakSet
jean.philippe.mague at gmail.com
jean.philippe.mague at gmail.com
Thu Oct 5 12:53:04 EDT 2006
Hello,
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
TypeError: unsupported operand type(s) for &: 'set' and 'instance'
the hard olution would add the following behavior:
>>>(s&ws).__class__() is WeakSet
True
Any hint for the easy solution ?
for the hard one ?
Jean-Philippe
More information about the Python-list
mailing list