[IronPython] Keyword arguments

Brian Quinlan brian at sweetapp.com
Tue Aug 24 16:33:22 CEST 2004

Currently it appears, at least for constructors, that IronPython is
transforming keyword arguments into attribute assignments e.g.

>>> Rectangle(2,3,2,3)
>>> Rectangle(2,3,2,3, Height=20, Location=Point(5, 5), X=10)

You can see that for the last rectangle ctor, IronPython did the
equivalent of this C# code:

r = new Rectangle(2, 3, 2, 3);
r.Height = 20;
r.Location = new Point(5, 5);
r.X = 10;

I would argue strongly that this is a bad idea; keyword arguments should
have the same semantics as they do in CPython. The most obvious reason
that I can think of is that keyword arguments, used as in CPython, can
clarify the meaning of various arguments. Compatibility is also an issue
as is 3rd party tools support. I actually noticed this problem while
writing a script to add .NET Framework intellisense support to
ActiveState's Python IDE. If anyone is interested in either the source
or the datafile, please let me know.


More information about the Ironpython-users mailing list