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

Guido van Rossum guido at python.org
Thu Feb 28 18:32:57 CET 2013


Hm. I write code regularly that takes a **kwargs dict and stores it
into some other longer-lasting datastructure. Having that other
datastructure suddenly receive OrderedDicts instead of plain dicts
might definitely cause some confusion and possible performance issues.
And I don't recall ever having wanted to know the order of the kwargs
in the call.

But even apart from that backwards incompatibility I think this
feature is too rarely useful to make it the default behavior -- if
anything I want **kwargs to become faster!

On Thu, Feb 28, 2013 at 2:15 AM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> Just wanted to put out some feelers for the feasibility of these two
> features:
>
> * have the **kwargs param be an OrderedDict rather than a dict
> * have class definitions happen relative to an OrderedDict by default rather
> than a dict, and still overridable by a metaclass's __prepare__().
>
> Both of these will need OrderedDict in C, which is getting close (issue
> #16991).
>
> -eric
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



--
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list