Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Order only retained in OrderedDict #31

Closed
hynek opened this issue May 23, 2019 · 3 comments · Fixed by #32
Closed

Order only retained in OrderedDict #31

hynek opened this issue May 23, 2019 · 3 comments · Fixed by #32

Comments

@hynek
Copy link

hynek commented May 23, 2019

As of Python 3.7, dicts are ordered in Python 🎉 but it seems like aspy.yaml only retains order for OrderedDicts? Any chance of fixing this for 3.7 and later?

@asottile
Copy link
Member

iiiiiinteresting! I had assumed this would become unnecessary in python3.6+ but it seems like pyyaml is sorting the mapping?

>>> print(aspy.yaml.ordered_dump({'a': 1, 'b': '2', 'd': 3, 'c': 4, 'f': 6}))
a: 1
b: '2'
c: 4
d: 3
f: 6

let's see what I can do to turn that off 🤔

@asottile
Copy link
Member

that was easy! See #32

@asottile
Copy link
Member

thanks for the issue! This has been released as part of v1.3.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants