Live data from Hacker News

Why is Python's OrderedDict ordered?

piglei.com

11–18 of 18 posts

Re: Why is Python's OrderedDict ordered?

#11

Earlier 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.

Swift (heavily used by Apple) has randomly ordered dictionaries for security: > 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-...

Perhaps not unrelated to why Python is the #1 most popular language while Swift is #22 https://www.tiobe.com/tiobe-index/

Re: Why is Python's OrderedDict ordered?

#12

Earlier quoted context omitted.

Swift (heavily used by Apple) has randomly ordered dictionaries for security: > 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-...

Perhaps not unrelated to why Python is the #1 most popular language while Swift is #22 https://www.tiobe.com/tiobe-index/

Swift isn’t popular because its Dictionary type uses randomly ordered keys?

Re: Why is Python's OrderedDict ordered?

#13
post #2

Title 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.)

Thanks, How makes much more sense. The post title is dumb.

Why is Hackernews news for hackers?

Re: Why is Python's OrderedDict ordered?

#14

Earlier quoted context omitted.

Perhaps not unrelated to why Python is the #1 most popular language while Swift is #22 https://www.tiobe.com/tiobe-index/

Swift isn’t popular because its Dictionary type uses randomly ordered keys?

Probably the inference is YAGNI .

Re: Why is Python's OrderedDict ordered?

#15
post #13
post #2

Title 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.)

Thanks, How makes much more sense. The post title is dumb. Why is Hackernews news for hackers?

The URL for the post includes "why" (en-why-is-python-ordereddict-ordered), so I suppose the title of the article was updated after the HN post was created. The site's native language is Chinese and I'm guessing the post was translated via automation. In fact, if you run the article through an automated translation service (Google Translate), it reproduces the "Why" title.

Re: Why is Python's OrderedDict ordered?

#16
post #13

Earlier quoted context omitted.

Thanks, How makes much more sense. The post title is dumb. Why is Hackernews news for hackers?

The URL for the post includes "why" (en-why-is-python-ordereddict-ordered), so I suppose the title of the article was updated after the HN post was created. The site's native language is Chinese and I'm guessing the post was translated via automation. In fact, if you run the article through an automated translation service (Google Translate), it reproduces the "Why" title.

Thanks, makes sense.

Re: Why is Python's OrderedDict ordered?

#17

Earlier quoted context omitted.

Perhaps not unrelated to why Python is the #1 most popular language while Swift is #22 https://www.tiobe.com/tiobe-index/

Swift isn’t popular because its Dictionary type uses randomly ordered keys?

It certainly could be a reason among many. Just look at the thread GP shared, containing multiple years' worth of users voicing frustration at the introduction of this behavior.

Re: Why is Python's OrderedDict ordered?

#18
post #2

Title 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.)

^ came here to say exactly this
Post reply on HN