Why pickling (was: Traceback when using multiprocessing)

John Ladasky john_ladasky at sbcglobal.net
Fri Nov 22 11:38:39 EST 2013


On Thursday, November 21, 2013 8:24:05 PM UTC-8, Chris Angelico wrote:

> Oh, that part's easy. Let's leave the multiprocessing module out of it
> for the moment; imagine you spin up two completely separate instances
> of Python. Create some object in one of them; now, transfer it to the
> other. How are you going to do it?

For what definition of "completely separate"?

If I have two instances of the same version of the Python interpreter running on the same hardware, and the same operating system, I expect I would just copy a block of memory from one interpreter to the other, and then write some new pointers.  That kind of data sharing has to be the most common kind.  It's also the simplest.

I understand that pickling allows sharing of Python objects between Python interpreters even if those interpreters run on different CPU's with different memory architecture, different operating systems, etc.  It just seems like overkill to me to use pickling in the simple case.



More information about the Python-list mailing list