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

Dody Gunawinata empirebuilder at gmail.com
Tue Aug 19 17:58:06 CEST 2008


This is a better approach.

On Tue, Aug 19, 2008 at 6:50 PM, Dino Viehland <dinov at microsoft.com> wrote:

> Is there a reason ObjectOperations.Call(scope.GetVariable("Process"), args)
> doesn't work?  Once you have the function in hand you can call using this
> and it takes a params array.  That params array will be splatted for the
> call expanding to however many arguments there are there.
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] On Behalf Of Christian Schmidt
> Sent: Tuesday, August 19, 2008 7:50 AM
> To: dody at nomadlife.org; Discussion of IronPython
> Subject: Re: [IronPython] IP 2: Execute multiple expression in different
> scopes
>
> Hi Dody,
>
> thanks for your patience.
>
> > 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.
>
> I'd say in python this is def f(*arg) and def f(**dict), or not?
>
> Probably I need the "params object[]"-approach, because I'll use the
> argument's name and not index.
>
> The question is, how a PythonFunction can be casted to a delegate of a
> certain type or if that is not possible, how can the PythonFunction be
> called from C#?
>
> Regards,
> 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/2990d461/attachment.html>


More information about the Ironpython-users mailing list