From: eryk sun <eryk...@gmail.com> Sent: Saturday, April 22, 2017 7:59 AM To: Python Main Cc: Albert-Jan Roskam Subject: Re: OrderedDict with kwds On Fri, Apr 21, 2017 at 6:08 PM, Albert-Jan Roskam <sjeik_ap...@hotmail.com> wrote: > Would the insertion order be preserved if the last line were to be > replaced with: > > if kwds: > for k, v in kwds.items(): > self[k] = v > if args: > self.__update(*args) # no **kwds!
The basic problem is that kwds is a regular, unordered dict: def f(**kwds): print(type(kwds)) >>> f() <class 'dict'> ----> Hi Eryk, Yes, I realized this later that evening (probably thanks to can of cold beer :-)). But there is hope: https://www.python.org/dev/peps/pep-0468/ . Do you know if there is/will be a "from __future__" to backport that behavior? We're using Python 3.5 now. Thank you! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list