OrderedDict with kwds

INADA Naoki songofacandy at gmail.com
Sat Apr 22 12:28:17 EDT 2017


On Sat, Apr 22, 2017 at 10:41 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
> INADA Naoki <songofacandy at gmail.com> writes:
>
>> From Python 3.6, keyword arguments are ordered. So the docstring is
>> outdated.
>
> (Thank you, Inada-san, for the implementation!)
>
> The announcement of the change specifies that we should not rely on
> ordered ‘dict’:
>
>     The order-preserving aspect of this new implementation is considered
>     an implementation detail and should not be relied upon […].
>
>     <URL:https://docs.python.org/3.6/whatsnew/3.6.html#new-dict-implementation>
>
> 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.

See https://www.python.org/downloads/release/python-360/

> PEP 468 Preserving Keyword Argument Order

While dict's order is implementation detail, keyword is ordered by
language spec.
You can rely on it on Python 3.6+.


More information about the Python-list mailing list