Mixing different interpreters in the same program

Jaime Buelta jaime.buelta at gmail.com
Thu Oct 22 03:00:25 EDT 2009


Hello:

  I keep thinking from some time ago in how to conect two or more
Python interpreters. This began as interest in calling Java code from
C program, which was solved (at the time) using an intermediate file.

  But having CPython and Jython, I think it would be great to call a
function from, let's say, a CPython interpreter and execute java code.

  I been reading about the multiprocessing module, but doesn't been
able to call the Jython interpreter from CPython. Also, Jython is
still at version 2.5 and doesn't have the multiprocessing, so it won't
probably work either.

  Any way, thinking like a "wish list", I think it will be very
interesting a module with the following behaviour to make python even
more powerful in gluing things up.
  Could make "from MyModule import java" or "from MyModule import
jython", so the module will start a jython interpreter. Then call code
to be executed on the jython interpreter like 'jython.javafunction'

  Of course, it could be also an "import ironpython" to start an
IronPython or any other Python interpreter configured. Or "import
cpython" from jython.

  Regarding performance, which I think won't be never great at it has
some overhead setting interpreters up, sending data, etc, it will be
great to add a MyModule.exec(function) to execute completely a funtion
on the "remote interpreter"

  Well, just thinking about some ideas and sharing with you ;-)

  Best regards,
     Jaime



More information about the Python-list mailing list