Author rhettinger
Recipients Dennis Sweeney, docs@python, maximeLeurent, rhettinger, serhiy.storchaka
Date 2021-07-31.04:33:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I'm thinking that the current LRU() recipe should be changed to lru_cache() API using an OrderedDict internally rather than inheriting from it.   The current recipe was intended to be a sketch rather than a complete class; otherwise, methods like get() would also need to have been provided.

Also, the resolution of issue 27275 doesn't look correct.  The pop() method should not depend on the subclasses' __getitem__ method.   In this regard, the pure python code for OrderedDict is correct and matches what regular dictionary's do (overriding __getitem__ has no effect on other methods).  This leaves to the class "open for extension but closed for modification".  Most of our container classes follow this pattern unless specifically documented to the contrary (i.e. a framework pattern).
Date User Action Args
2021-07-31 04:33:09rhettingersetrecipients: + rhettinger, docs@python, serhiy.storchaka, Dennis Sweeney, maximeLeurent
2021-07-31 04:33:09rhettingersetmessageid: <>
2021-07-31 04:33:09rhettingerlinkissue44782 messages
2021-07-31 04:33:08rhettingercreate