[IronPython] IP 2: Execute multiple expression in different scopes

Dody Gunawinata empirebuilder at gmail.com
Tue Aug 19 12:26:10 CEST 2008


scope.GetVariable<Func<int,int,int,int>> ("Process")

On Tue, Aug 19, 2008 at 12:09 PM, Christian Schmidt <
christian2.schmidt at gmx.de> wrote:

> 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
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
nomadlife.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080819/967384ff/attachment.html>


More information about the Ironpython-users mailing list