ShopperCove
Menu
All writingBlogTopicsCategoriesAboutRSS
Blog
Categories
Observability & SRE62All categories
Topics
sre111localhost lab102performance70python58javascript47bundle size36benchmarking35node.js35web development21typescript19benchmark16content creation15All topics
About
Loading article…

ShopperCove

Hands-on notes on developer tools, written after the tool has actually been run.

All writingBlogCategoriesTopicsAboutPrivacyRSS

© 2026 ShopperCove

On this page

  1. What "ordered" means here
  2. Version history
  3. When to use OrderedDict
  4. Sources
  1. Blog

Are Python Dictionaries Ordered? Yes, Since 3.7

Insertion order is a language guarantee, not an implementation accident.

Aditya Challa·12 October 2026·1 min read

Summary

Disclosure

This post contains affiliate links. If you buy through them, I may earn a commission at no extra cost to you. I only make firsthand claims about products I have actually used.

On this page
  1. What "ordered" means here
  2. Version history
  3. When to use OrderedDict
  4. Sources

Yes, Python dictionaries preserve insertion order, and the language has guaranteed it since Python 3.7. Iterating over a dict, or its keys, values and items, returns entries in the order they were first inserted.

What "ordered" means here

Updating an existing key keeps its original position. Deleting a key and adding it again moves it to the end.

d = {"b": 1, "a": 2}
d["c"] = 3
list(d)  # ['b', 'a', 'c']

Version history

The Python docs note: "Changed in version 3.7: Dictionary order is guaranteed to be insertion order." CPython 3.6 already behaved this way as an implementation detail.

When to use OrderedDict

collections.OrderedDict still adds move_to_end() and treats order as significant when comparing two OrderedDicts for equality, which plain dicts do not.

Related: /blog/is-python-3-14-free-threaded-by-default

Related: /blog/what-does-if-name-main-do-in-python

Sources

  • 01docs.python.org/3/library/stdtypes.html
  • 02docs.python.org/3/library/collections.html
pythondictionariesordereddictinsertion ordercpythondata structures

Lab evidence

What I found running this

Facts in this draft were checked on 12 Oct 2026 against the primary sources listed in the body (official docs, release schedules or Google/YouTube help pages). No benchmarks or timings were run, so the post makes no performance or measurement claims; dates are quoted as published by the maintainers, and any estimate is labelled as such.

Explore the product

Freelancers and devs who want to turn coding skills into paid site builds

Build ready-made client websites faster

Check out Ready Client Sites

Notes when a lab post goes up

Occasional email for new hands-on reviews. No sequence and no sponsors.

Explore the product

Freelancers and devs who want to turn coding skills into paid site builds

Build ready-made client websites faster

Check out Ready Client Sites

Keep reading

  • math.fsum vs sum Float Totals: Localhost Lab

    Hands-on math.fsum vs builtin sum for float totals: real items/s plus cancellation accuracy, measured on Linux localhost in this hands-on lab for SREs.

    Summary1 Oct 20264 min read

  • What Does yield Do in Python? Generators Explained

    Generators, lazily: what yield actually does to a function.

    Summary12 Oct 20261 min read

  • What Is the Walrus Operator (:=) in Python? Examples

    Assignment expressions, explained with the examples that actually help.

    Summary12 Oct 20261 min read