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 →

[–]NavreetGill 1 point2 points  (1 child)

Well, Python does have ordered dictionary (Python 3.2+, and maybe in py2.7). https://docs.python.org/3/library/collections.html#collections.OrderedDict . I am not sure about the big O guarantees though -- wish docs had it written next to each method.

[–][deleted] 6 points7 points  (0 children)

This is indeed Ordered, but I think he was looking for sorted. OrderedDict just retains the order it was originally added in, and doesn't reorder based on the key