At Wednesday 8/11/2006 05:26, George Sakkis wrote:
Or you may have this done automatically by hacking the Set class:
from sets import Set
import cPickle as pickle
Set.__reduce__ = lambda self: (set, (self._data,))
s = Set([1,2,3])
x = pickle.dumps(s)
print pickle.loads(x)
This doesn't work
Nick Vatamaniuc wrote:
> The two are not of the same type:
>
> -
> In : import sets
> In : s1=sets.Set([1,2,3])
>
> In : s2=set([1,2,3])
>
> In: type(s1)
> Out:
>
> In : type(s2)
> Out:
>
> In : s1==s2
> Out: False # oops!
>
> In: s2==set(s1)
> Out: True # aha!
The two are not of the same type:
-
In : import sets
In : s1=sets.Set([1,2,3])
In : s2=set([1,2,3])
In: type(s1)
Out:
In : type(s2)
Out:
In : s1==s2
Out: False # oops!
In: s2==set(s1)
Out: True # aha!
--
You'll have to ju