-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add ODict to Base for OrderedDict #38163
Comments
There is nothing difficult about using OrderedDict from a package. |
@PallHaraldsson I think the value would be in modifying the behaviour in So, one possible outcome would be to reverse the roles of |
Discussion about making the default dict ordered can be had in #34265. It's, however, not useful to just copy-paste a Dict implementation from a package into Base as a new date structure. |
"unordered
Dict
iteration is a bug waiting to happen. Your PR would fix that."My answer: https://discourse.julialang.org/t/replacement-for-dict-is-anyone-using-isslotfilled/48810/16?u=palli
I started that thread, asking if people would like Dict changed to ordered, but I realize by now that it's probably better to add the non-default ODict, so people can choose that, easily. At some point, e.g. Julia 2.0 we could change Dict to refer to ODict.
I neglected to mention the PR #38145, and one of the answers were:
"Generally, if you want something changed in Base and you want concrete feedback, it is best to make a PR"
elsewhere, people called for discussion. My PR already adds OrderedDict, and it works, it's just test failing because I'm replacing Dict, and with rather adding it as ODict, all the problems would go away.
@andyferris, I DO have some concerns, I thought I could choose any of the implementations, of ordered (not sorted) dicts available, but there's also this one I haven't looked at too closely (would it be better/ready?):
andyferris/Dictionaries.jl#31 (comment)
Python added ordered dict to its standard library (despite "existing Python ordered-dict implementations") in 2008, with in rationale "PHP and Ruby 1.9 guarantee a certain order on iteration":
https://www.python.org/dev/peps/pep-0372/
Then for Python 3.7, in 2017-2018 the default dict became ordered by default:
https://mail.python.org/pipermail/python-dev/2017-December/151283.html
with changed implementation:
Remove doubly-linked list from C OrderedDict
https://bugs.python.org/issue31265#msg301942
The text was updated successfully, but these errors were encountered: