[IronPython] Keyword Arguments For C# Functions

Curt Hagenlocher curt at hagenlocher.org
Wed Nov 26 13:37:48 CET 2008


Oh, and I think the 1.1-equivalent of ParamDictionaryAttribute is
ParamDictAttribute.

On Wed, Nov 26, 2008 at 4:33 AM, Curt Hagenlocher <curt at hagenlocher.org>wrote:

> The keyword arguments you've seen used on CLR classes are actually using
> properties as initializers.  That is,
>
> tb = System.Windows.Forms.TextBox(Text = 'Hello')
>
> is exactly equivalent to
>
> tb = System.Windows.Forms.TextBox()
> tb.Text = 'Hello'
>
> On Wed, Nov 26, 2008 at 12:38 AM, Dave Moor <D.Moor at sim-soft.co.uk> wrote:
>
>> Hi Everyone
>>
>> I am developing a C# application using VS2005 and IronPython v1.1.0
>> (currently). I am trying to add a function to a C# class that will be
>> callable from IronPython which will take a keyword argument list mimicking:
>>
>> def fred(self, name, **kwargs):
>>
>> I found this link
>> http://blogs.msdn.com/srivatsn/archive/2008/09/09/passing-keyword-args-to-c-methods-from-ironpython.aspxbut I don't have Microsoft.Scripting
>> available.
>>
>> However IronPython allows kwargs on contructors of standard clr classes
>> like System.Windows.Forms.TextBox etc., can I use the same magic as that?
>>
>> I looked in the source of v1.1.2, do I need to do 'something' with
>> IronPython.Runtime.Calls.KwArgBinder and if so what?  Is there a sample
>> somewhere I've missed?  Or is it covered in IronPython in Action, if so I
>> guess I'd better stick my hand in my pocket :)
>>
>> Thanks in advance
>>
>> Dave
>>
>>
>> --
>> Registered Office
>> Mill House, Hawksworth Road, Horsforth, Leeds, LS18 4JP England.
>> Reg No. 1311728 Eng.
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081126/2b448302/attachment.html>


More information about the Ironpython-users mailing list