for , in ds items()print( ,va for , in items()print( ,va ahour dictionary is sorted and the normal dictionary is not hurrayif you wanted to use this class in productionyou' have to override several other special methods to ensure the keys are up to date in all cases howeveryou don' need to do thisthe functionality this class provides is already available in pythonusing the ordereddict object in the collections module try importing the class from collectionsand use help(ordereddictto find out more about it queues queues are peculiar data structures becauselike setstheir functionality can be handled entirely using lists howeverwhile lists are extremely versatile general-purpose toolsthey are occasionally not the most efficient data structure for container operations if your program is using small dataset (up to hundreds or even thousands of elements on today' processors)then lists will probably cover all your use cases howeverif you need to scale your data into the millionsyou may need more efficient container for your particular use case python therefore provides three types of queue data structuresdepending on what kind of access you are looking for all three utilize the same apibut differ in both behavior and data structure before we start our queueshoweverconsider the trusty list data structure python lists are the most advantageous data structure for many use casesthey support efficient random access to any element in the list