[IronPython] IP 2: Execute multiple expression in different scopes
Christian Schmidt
christian2.schmidt at gmx.de
Tue Aug 19 16:50:02 CEST 2008
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
More information about the Ironpython-users
mailing list