[Ironpython-users] Calling Python function from C# with **args?

Doug Blank doug.blank at gmail.com
Thu Apr 18 20:08:56 CEST 2013


On Wed, Apr 17, 2013 at 11:42 AM, Jeff Hardy <jdhardy at gmail.com> wrote:
> On Wed, Apr 17, 2013 at 7:00 AM, Doug Blank <doug.blank at gmail.com> wrote:
>> IronPython users,
>>
>> Is there a way to call a Python function or method defined like:
>>
>> def func(**args):
>>     return args
>>
>> from C#?
>
> PythonCalls.CallWithKeywordArgs should do what you want. If you don't
> have a CodeContext handy you should be able to use
> DefaultContext.Default.

Is there a DLR-level way to do the same thing? For example, is there
an interface in language-agnostic code that can call a DLR-based
language with named arguments? For example, how would I do this same
thing for a Ruby (or some other) DLR language? Or does DynamicObject
solve that issue?

Also, will take a move to .NET 4 to be able to call generic C# code
with named parameters?

-Doug

> - Jeff


More information about the Ironpython-users mailing list