> For the complete documentation index, see [llms.txt](https://wiki.theconfused.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.theconfused.me/programming/python/python-dictionaries-are-insertion-ordered-from-3.7+.md).

# Python dictionaries are insertion-ordered from 3.7+

They are insertion-ordered in CPython implementation of Python 3.6 as an implementation detail. [Guido announced on the mailing list](< https://mail.python.org/pipermail/python-dev/2017-December/151283.html>) that it is officially part of the language spec in Python 3.7. From [the docs](https://docs.python.org/3.7/library/stdtypes.html#mapping-types-dict):

> Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was implementation detail of CPython from 3.6.

`list(d)` on a dictionary returns a list of all the keys used in the dictionary, in insertion order.&#x20;

Sets are still unordered.&#x20;
