jython question (interesting behavior)
zsolt-googleP6463 at mailblocks.com
Fri Mar 4 01:06:31 CET 2005
Is this the correct place to post a jython question?
I posted the following in the jython group, but I figured I'd post here
I am assuming that the PythonInterpreter environment is not a unique
environment from within a jvm.
Here is some pseudo code to show what I am talking about
1) create a jython module file, lets call it "mytest"
with a simple static class
myVar = "test01"
2) Now set up two interpreter environments from within
the same jvm
PythonInterpreter py = new PythonInterpreter()
PythonInterpreter py1 = new PythonInterpreter()
3) now in both interpreters, import the module
Now for both interpreters run
4) Now for the crazy part.
in the py interpreter run
"mytest.simpleS.myVar = 'test02'
in py1 look at the value
Very interesting behavior. So it seems that each python interpreter
instance does not act as its own seperate space.
Maybe I just have not gotten there yet with the docs. I did notice
something about the initialize() function associated with the
interpreter which is only supposed to be run once.
More information about the Python-list