←back to thread

191 points jwilk | 1 comments | | HN request time: 0.193s | source
Show context
drhagen ◴[] No.46230206[source]
Great! Now make `set` have a stable order and we're done here.
replies(1): >>46230375 #
cr125rider ◴[] No.46230375[source]
Aren’t sets unsorted by definition? Or do repeated accesses without modification yield different results?
replies(4): >>46230852 #>>46230876 #>>46230887 #>>46231151 #
ledauphin ◴[] No.46230876[source]
this is likely in reference to the fact that dicts have maintained insertion order since Python ~3.6 as property of the language. Mathematically there's no defined order to a set, and a dict is really just a set in disguise, but it's very convenient for determinism to "add" this invariant to the language.
replies(2): >>46230993 #>>46231182 #
1. jonathaneunice ◴[] No.46230993[source]
Debugging is a completely different and better animal when collections have a predictable ordering. Else, every dict needs ordering before printing, studying, or comparing. Needlessly onerous, even if philosophically justifiable.