←back to thread

191 points jwilk | 1 comments | | HN request time: 0.28s | 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 #
1. Retr0id ◴[] No.46230887[source]
A stable order does not imply sorted order. If you convert the same set to a list twice you'll probably get the same order both times but it isn't guaranteed anywhere, and that order may change between python implementations and versions. The order may also change as the set grows or shrinks.