[Python-Dev] [RFC] Removing pure Python implementation of OrderedDict

Antoine Pitrou solipsis at pitrou.net
Tue Sep 5 09:22:48 EDT 2017


On Tue, 5 Sep 2017 17:38:06 +0900
INADA Naoki <songofacandy at gmail.com> wrote:
> 
> Like that, how about removing OrderedDict Pure Python implementation
> from stdlib and require it to implementation?

I don't like this.  The C version of OrderedDict is probably very hard
to read, while the Python version helps understand the semantics.
Also, when devising a new API, it's much easier to first try it out on
the Python version.

> I'm considering adding `OrderedDict.lru_get(key, default=None)`  which
> atomically lookup key and move the key to end if found.

The Python version needn't have the same atomicity requirements as the
C version.

Regards

Antoine.




More information about the Python-Dev mailing list