Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't sort keys by default #403

Open
dingens opened this issue May 20, 2020 · 0 comments
Open

Don't sort keys by default #403

dingens opened this issue May 20, 2020 · 0 comments

Comments

@dingens
Copy link

dingens commented May 20, 2020

This is a part of or followup to #110, creating a new one to structure the discussion.

Basically my point is what @feluxe said there:

sort_keys = True is nothing I would expect from a dumper by default, especially not from a YAML dumper. A dumper should convert data from one format into another, there is no reason for it to sort the data. YAML is a human readable format and used for user configs a lot. If you run a key sort on a user config you end up with a mess. It already happened to me a couple of times working with python/pyyaml. It's annoying and it shouldn't be. Just my 2 cents. :)

I agree to that. Not sorting should be the default, in the long term at least.

In the #110 discussion, the backwards compatibility issue was mentioned a couple times, but only in the form of "it might be an issue", nobody could think of an actual case where this were a problem.
Others mentioned that the sorting was not explicitly mentioned anywhere in the docs, so users couldn't really rely on it anyways.

If backwards compatibility is really the issue that prevents this, then I would suggest to use some deprecation process (now that the sort_keys option is available, users can set it to True if they really need sorting). That process would take some time, but I think it would still be better if not sorting was the default in a couple of years than never.

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

No branches or pull requests

1 participant