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

Dody Gunawinata empirebuilder at gmail.com
Tue Aug 19 16:11:32 CEST 2008


delegate System.Int32 FunctionProcess(System.Int32[] parameters)

This assumes that your Python implement will only do integer operation. If
you are going to use the delegate for generic holder of arguments, don't
forget to cast

for example:
delegate object FunctionProcess(object[] parametser)

python = @"
def myItems(myParams)
    val1 = Int(myParams[1])
    val2 = Int(myParams[2])

    return val1 + val2
"

You pretty much need to take care of the conversion. I don't think "*params
object[]* "is supported on the hosting DLR because IronPython doesn't
support this construct.




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

> Hi Dody,
>
> thanks for your help.
>
> > delegate object FunctionProcess(object[] params);
>
> I've already tried this one and also
> delegate object FunctionProcess(params object[] p);
>
> > scope.GetVariable<FunctionProcess> ("Process")
>
> But get an ArgumentException ("Invalid type of return expression value at
> 0:0-0:0") here. Any ideas?
>
> > and modify your Python code to deal with the object[] params.
>
> Could you be more specific here?
>
> Thanks,
> 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/f68ee11a/attachment.html>


More information about the Ironpython-users mailing list