-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
Description
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
Metadata
Metadata
Assignees
Labels
Projects
Status
Todo