[IronPython] IP 2: Execute multiple expression in different scopes
Christian Schmidt
christian2.schmidt at gmx.de
Tue Aug 19 11:09:02 CEST 2008
Hi Curt,
thanks for your answer. It's an interesting idea, to hand over the items
as function arguments. I was trying to add them to the ScriptScope.
But I'm still stuck with calling the function:
ScriptScope scope =
ScriptRuntime.Create().GetEngine("py").CreateScope();
scope.Execute("from math import *");
scope.Execute(@"
def process(a, b, c):
return [a+b, sqrt(b*c)]
");
object process = scope.GetVariable("process");
foreach(object[] row in data)
object[] result = process(row); // ??
How do I call the function?
I have some further question regarding this approach:
1. Will the function be interpreted on each call or is it compiled?
2. Is the number of arguments limited? I could have up to 200 arguments.
Meanwhile I've tried the CustomSymbolDictionary way, but couldn't find
any helpful tutorial.
Thanks for your time,
Christian
More information about the Ironpython-users
mailing list