[Python-Dev] OrderedDict(kwargs) optimization?

Wes Turner wes.turner at gmail.com
Wed Nov 8 10:31:23 EST 2017


On Wednesday, November 8, 2017, Guido van Rossum <guido at python.org> wrote:

> It seems there must be at least two threads for each topic worth
> discussing at all. Therefore I feel compelled to point to
> https://mail.python.org/pipermail/python-dev/2017-November/150381.html,
> where I state my own conclusion about dict order.
>
>
.


>
> Finally: the dict type should not be endowed with other parts of the
> OrderedDict API, not should other API changes to dict be considered.
>

Is there an opportunity to support a fast cast to OrderedDict from 3.6 dict?
Can it just copy .keys() into the OrderedDict linked list?Or is there more
overhead to the transition?

That'd be great for preserving kwargs' order after a pop() or a del?

def func(**kwargs):
    kwargs = OrderedDict(kwargs)
    arg2 = kwargs.pop('arg2')


>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171108/f7b9c2e7/attachment-0001.html>


More information about the Python-Dev mailing list