Thanks,

"Why do you even need the classes code object anyway?"

I need to instantiate and use the class in another process.
This other process doesn't has access to the py or pyc file
holding the m_class (source) code so I can't use pickle.

Something like;
In the first process (that has access to my_class (source) code) I do;

c = compile(inspect.getsource(my_class), "<script>", "exec")
s = marshal.dumps(c)
# Send s to other process

In the other process, lacking access, I do;

c = marshal.loads(s)
exec c in my_dict
o = my_dict["my_class"]()
# Use o
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to