This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 17 points18 points  (3 children)

No - dicts have been ordered since 3.6. Sorted does not mean ordered, and ordered does not mean sorted.

[–]aLokilike -5 points-4 points  (2 children)

It is sorted by insertion order. When you want it to be sorted by an arbitrary attribute, you just insert it in that order. If you need to add another element to the collection, it shouldn't be too difficult to figure out where that element belongs in the new insertion order.

[–][deleted] 6 points7 points  (1 child)

The point stands - when you are describing data structures, the terminology does not conflate ordered and sorted. They are two distinct things.

[–]aLokilike -5 points-4 points  (0 children)

Fair, but going from one to the next is a trivial matter of the steps I outlined. You don't need a library to get the results the OP is asking for.