Skip to content
Discussion options

You must be logged in to vote

MicroPython was originally based on Python 3.4. The behavior you're seeing in Python where dictionaries maintain their insertion order was added in Python 3.7.

On most builds, we do support collections.OrderedDict, but you won't be able to use a dict literal to assign it.

It would be possible to make MicroPython match CPython here (and I believe there is a PR to do so) but it comes at a small overhead which seems wasteful for the majority of cases where you do not care about the insertion order.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mattytrentini
Comment options

mattytrentini Jul 25, 2023
Collaborator Sponsor

@jimmo
Comment options

@davefes
Comment options

Answer selected by davefes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants