classification
Title: LastUpdatedOrderedDict recipe uses super() unnecessarily
Type: Stage: resolved
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, rhettinger, wim.glenn
Priority: normal Keywords:

Created on 2019-05-13 22:21 by wim.glenn, last changed 2019-05-14 02:43 by rhettinger. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13296 merged wim.glenn, 2019-05-13 22:21
Messages (1)
msg342395 - (view) Author: wim glenn (wim.glenn) * Date: 2019-05-13 22:21
Section https://docs.python.org/3/library/collections.html#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)
            super().move_to_end(key)

Why does it use super().move_to_end(key), isn't self.move_to_end(key) more direct/Pythonic?
History
Date User Action Args
2019-05-14 02:43:00rhettingersetstatus: open -> closed
resolution: fixed
stage: resolved
2019-05-13 22:21:50wim.glenncreate