Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

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).

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44782>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to