Why is Python's OrderedDict ordered?
piglei.com
Why is Python's OrderedDict ordered?
1–10 of 18 posts
Re: Why is Python's OrderedDict ordered?
#2Re: Why is Python's OrderedDict ordered?
#3Re: Why is Python's OrderedDict ordered?
#4Title of the article is "How…", not "Why…", and "why" is not discussed. (My understanding is that the "why" is "because the implementation acted that way without an official guarantee, and folks depended on the implementation detail, so it became guaranteed.)
Re: Why is Python's OrderedDict ordered?
#5Title of the article is "How…", not "Why…", and "why" is not discussed. (My understanding is that the "why" is "because the implementation acted that way without an official guarantee, and folks depended on the implementation detail, so it became guaranteed.)
I don't think this is the "why". What you're depicting is what happened in JavaScript. Dictionary keys in Python always had that (to me) annoying property that they preserved insertion order until they don't. I'd frankly much prefer if they'd always be iterated in random order each time they're traversed.
Re: Why is Python's OrderedDict ordered?
#6Earlier quoted context omitted.
I don't think this is the "why". What you're depicting is what happened in JavaScript. Dictionary keys in Python always had that (to me) annoying property that they preserved insertion order until they don't. I'd frankly much prefer if they'd always be iterated in random order each time they're traversed.
I'd love to see the results of mandating a random order dict impl at an actual company/org (but hate to be forced to participate). Hopefully you hired developers who really like to write sorting algos.
Re: Why is Python's OrderedDict ordered?
#7Title of the article is "How…", not "Why…", and "why" is not discussed. (My understanding is that the "why" is "because the implementation acted that way without an official guarantee, and folks depended on the implementation detail, so it became guaranteed.)
I think the "how/why" thing is just the automatic title de-clickbait-ifer going a little haywire?
Re: Why is Python's OrderedDict ordered?
#8Earlier quoted context omitted.
I'd love to see the results of mandating a random order dict impl at an actual company/org (but hate to be forced to participate). Hopefully you hired developers who really like to write sorting algos.
Well, that is how hash tables in go works, so you'd not have to look that far.
Re: Why is Python's OrderedDict ordered?
#9Earlier quoted context omitted.
I'd love to see the results of mandating a random order dict impl at an actual company/org (but hate to be forced to participate). Hopefully you hired developers who really like to write sorting algos.
Well, that is how hash tables in go works, so you'd not have to look that far.
In any case, it is not ordered. If you want that, you have to explicitly sort the keys of the hash.
Re: Why is Python's OrderedDict ordered?
#10Earlier quoted context omitted.
I don't think this is the "why". What you're depicting is what happened in JavaScript. Dictionary keys in Python always had that (to me) annoying property that they preserved insertion order until they don't. I'd frankly much prefer if they'd always be iterated in random order each time they're traversed.
I'd love to see the results of mandating a random order dict impl at an actual company/org (but hate to be forced to participate). Hopefully you hired developers who really like to write sorting algos.
> In particular, random seeding enables better protection against (accidental or deliberate) hash-flooding attacks
https://forums.swift.org/t/psa-the-stdlib-now-uses-randomly-...