bendudson / py4cl

Call python from Common Lisp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

individual instances for different processes?

jnc-nj opened this issue · comments

Currently it seems that a single python process is instantiated for a single instance of lisp.
This is problematic in multithreaded applications where each thread requires it's own python instance so that variables with the same name don't clash during assignment
Would it be possible to flush the contents of the python process or simply restart the python process?

oh found the relevant commands in python-process.lisp
should probably be documented in the front-page readme

thanks anyways! love the work.

The variable *python* is used to store the python process:
https://github.com/bendudson/py4cl/blob/master/src/python-process.lisp#L9
Perhaps that could be made thread-local by dynamic binding:

(let ((*python* (...)))
   ...)

Currently py4cl:python-start (https://github.com/bendudson/py4cl/blob/master/src/python-process.lisp#L17) sets *python*, but perhaps a new function could return the process handle without setting *python* itself.

An alternative would (perhaps) be to add a keyword to all functions, enabling a python process handle to be passed in.