Velocity Reviews

Velocity Reviews (
-   Python (
-   -   Pass data to a subprocess (

andrea crotti 07-31-2012 01:56 PM

Pass data to a subprocess
I'm having fun in the world of multiprocessing, and I would like some

For example suppose I want to create many processes and pass them some
data to process (also why they are running).

I found many nice things (Pipe, Manager and so on), but actually even
this seems to work:

class MyProcess(Process):
def __init__(self):
Process.__init__(self) = []

def __str__(self):
return str(

def add(self, ls): += ls

def run(self):
print("running the process in another subprocess")

def procs():
mp = MyProcess()
# with the join we are actually waiting for the end of the running time

Which is a bit surprising, because it means that I can pass data to an
object that is running on another process.
Is it because of some magic in the background and can I rely on that or
simply I didn't understand how it works?

All times are GMT. The time now is 03:55 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.