Python has pickle, and .NET has System.Runtime.Serialization, and they
do roughly the same thing.

So one should be able to pickle any .NET objects that is serializable.

As Python's pickle has a mechanism to register custom hooks, I wrote
hooks to delegate pickling of .NET objects to
System.Runtime.Serialization. It works fine!

This is how it looks like:

from System import DateTime
import pickle
import fepy.pickle
fepy.pickle.register(DateTime)

obj = DateTime.Now
string = pickle.dumps(obj)
newobj = pickle.loads(string)
assert obj == newobj

Does it make to sense to do the reverse? That is, making picklable
Python objects serializable by, I guess, implementing ISerializable? I
have no idea how to go about that. Any suggestions welcome.

-- 
Seo Sanghyeon
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to