Sorry to bother you again.

>x = compile("2+2", "<string>", "eval")
>for i in xrange(123456789):
>    eval(x)
>
>  
>
In this code, what object is assigned to the x var? Can I just store it 
by calling PythonEngine.Evaluate once than invoke multiple times passing 
it as variable:

PythonEngine engine = new PythonEngine();
object x = engine.Evaluate("compile('2+2', '<string>', 'eval')");

and somewhere else

PythonEngine engine2 = new PythonEngine();
engine2.SerVariable("x", x);
object result = engine.Evaluate("eval(x)");

Besides, my scripts are not always simple expressions. Sometimes there 
are multiple statements and thats why I mostly use PythonEngine.Execute 
method. Would the compile function also handle such case? (I guess the 
kind argument would should be 'exec' then)


Szymon.
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to