[Python-ideas] OrderedDict for kwargs and class statement namespace

Antoine Pitrou solipsis at pitrou.net
Fri Mar 1 10:26:54 CET 2013


Le Fri, 01 Mar 2013 00:31:28 +0100,
Christian Heimes <christian at python.org> a
écrit :
> Am 28.02.2013 22:53, schrieb Eric Snow:
> > Good point.  My own use of **kwargs rarely sees the object leave the
> > function or get very big, and this aspect of it just hadn't come up
> > to broaden my point of view.  I'm glad we're having this
> > discussion.  My intuition is that such a use case would be pretty
> > rare, but even then...
> 
> I guess most function calls don't need the feature of ordered kwargs.
> Could we implement yet another prefix that turns unordered keyword
> arguments into ordered keyword arguments, e.g. ***ordkwargs (3 *) and
> METH_VARARGS|METH_KEYWORDS|METH_ORDERED PyMethodDef.ml_flags? That
> would allow ordered keyword arguments while keeping backward
> compatibility to existing programs. Only functions that ask for
> ordered kwargs would have to pay the minor performance penalty, too.

Well, you know, the performance concern also applies to pure Python
functions, not just C ones ;)

Regards

Antoine.





More information about the Python-ideas mailing list