OrderedDict with kwds

Ben Finney ben+python at benfinney.id.au
Sun Apr 23 00:00:16 EDT 2017


INADA Naoki <songofacandy at gmail.com> writes:

> On Sat, Apr 22, 2017 at 10:41 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
> > So, I would recommend continuing to code as though ‘dict’ is not
> > ordered, at least until a Python version is released with a clear
> > statement that ordering can be relied upon.
>
> While dict's order is implementation detail, keyword is ordered by
> language spec.

Ah, I had missed that distinction. Thank you for the explanation.

Yes, Python 3.6 keyword arguments now preserve the order from the
function call. Great!

-- 
 \       “If you always want the latest and greatest, then you have to |
  `\          buy a new iPod at least once a year.” —Steve Jobs, MSNBC |
_o__)                                             interview 2006-05-25 |
Ben Finney



More information about the Python-list mailing list