On Apr 17, 5:46 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Have you tackled the communication problem? The way I see it, one > interpreter cannot "see" objects created in the other because they > have separate pools of ... everything. They can communicate by > passing serialized objects through ctypes, but that sounds like the > solutions that use processes.
I see two solutions to that. It is possible to use fine-grained locking on the objects that need to be communicated. ctypes can pass PyObject* pointers (ctypes.py_object), or we could resort to some C. When interpreter A get a PyObject* pointer from B (a total of four bytes on my computer), interpreter A can: (1) Acquire B's GIL (2) Increment the refcount of the PyObject* (3) Release B's GIL (4) Use the object as its own (synchronization is required) Sharing PyObject* pointer has the possibility of shooting your leg off. But I believe the small quirks can be worked out. The other option is to use serialized Queues like the processing module in cheese shop. I don't think it will be faster than similar mechanisms based on IPC, because object serialization and deserialization are the more expensive parts. -- http://mail.python.org/mailman/listinfo/python-list