How does pickle work?

by jesse in ,

Via Brett Cannon I had the pleasure of reading Alexandre Vassalotti's blog post: "Pickle: An Interesting Stack language". It's really an excellent read - I never quite grokked pickle (or it's brother, cPickle) the code in his post actually taught me about something else: the "code" module. To quote:

The code module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt.

So much to learn I have. It really is a great post - I've only ever used pickled for passing an object (or an object in a set state) from either one run of an application to the next (i.e: a cache) or from one machine to another (via multiple copy-like functions, yes I know about pyro)