Added a few important helper methods.

This commit is contained in:
Jeremy Fincher 2003-04-29 07:36:18 +00:00
parent 45cdde675c
commit ce6b03d52f

View File

@ -119,10 +119,11 @@ class set(object):
return False return False
def __getstate__(self): def __getstate__(self):
return self.d.keys() return (self.d.keys(),)
def __setstate__(self, t): def __setstate__(self, (L,)):
for x in t: self.d = {}
for x in L:
self.d[x] = None self.d[x] = None
def __len__(self): def __len__(self):
@ -140,6 +141,12 @@ class set(object):
except KeyError: except KeyError:
pass pass
def __eq__(self, other):
return self.d == other.d
def __ne__(self, other):
return not self.d == other.d
## def __getstate__(self): ## def __getstate__(self):
## return self.d ## return self.d