set of sets

Robert Kern rkern at ucsd.edu
Thu Aug 11 09:36:41 EDT 2005


Paolino wrote:
> Matteo Dell'Amico wrote:

>>Why don't you just use "frozenset"?
> 
> This is what I'm doing, but the problem remains IMO.
> Anyway with frozenset I have to override __new__ instead of __init__ to 
> make the initialization which is an operation not described in the 
> frozenset  docs, which  makes subclassing frozenset a different operation.

Don't subclass.

In [1]: s = frozenset()

In [2]: f = set()

In [3]: f.add(s)

In [4]: f
Out[4]: set([frozenset([])])

In [5]: f.remove(s)

In [6]: f
Out[6]: set([])

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list