Documentation
Here is the first example in OrderedDict Examples and Recipes:
class LastUpdatedOrderedDict(OrderedDict):
'Store items in the order the keys were last added'
def __setitem__(self, key, value):
super().__setitem__(key, value)
self.move_to_end(key)
As the name of the class states, when a key is updated, it is moved to the end. But the docstring mentions "keys were last added", which is the standard behavior of OrderedDict, while LastUpdatedOrderedDict overrides __setitem__ to move keys when they are updated.
Linked PRs
Documentation
Here is the first example in OrderedDict Examples and Recipes:
As the name of the class states, when a key is updated, it is moved to the end. But the docstring mentions "keys were last added", which is the standard behavior of
OrderedDict, whileLastUpdatedOrderedDictoverrides__setitem__to move keys when they are updated.Linked PRs