Pickling a class definition

Posted by Giorgio on Stack Overflow See other posts from Stack Overflow or by Giorgio
Published on 2010-04-13T02:39:10Z Indexed on 2010/04/13 2:42 UTC
Read the original article Hit count: 261

Filed under:
|

Is there a way to pickle a class definition?

What I'd like to do is pickle the definition (which may created dynamically), and then send it over a TCP connection so that an instance can be created on the other end.

I understand that there may be dependencies, like modules and global variables that the class relies on. I'd like to bundle these in the pickling process as well, but I'm not concerned about automatically detecting the dependencies because it's okay if the onus is on the user to specify them.

© Stack Overflow or respective owner

Related posts about python

Related posts about pickle