[IronPython] IP 2: Execute multiple expression in different scopes
Christian Schmidt
christian2.schmidt at gmx.de
Tue Aug 19 13:12:42 CEST 2008
Hi Dody,
> scope.GetVariable<Func<int,int,int,int>> ("Process")
The problem is that I do not know the number of arguments at compile
time but at runtime. So I need something like Func<param object[]>.
Anyway, this would only work if running on framework 3.5, which I can't
because of the problems brought up by Fernando Correia - Func IIRC is
only defined in .net 3.5, right?
Thanks,
Christian
> On Tue, Aug 19, 2008 at 12:09 PM, Christian Schmidt
> <christian2.schmidt at gmx.de <mailto: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 <mailto:Users at lists.ironpython.com>
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> --
> nomadlife.org <http://nomadlife.org>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
More information about the Ironpython-users
mailing list