[Python-Dev] [RFC] Removing pure Python implementation of OrderedDict (original) (raw)

Eric Snow ericsnowcurrently at gmail.com
Tue Sep 5 13:13:59 EDT 2017


On Tue, Sep 5, 2017 at 1:38 AM, INADA Naoki <songofacandy at gmail.com> wrote:

Like that, how about removing OrderedDict Pure Python implementation from stdlib and require it to implementation?

-1

Like Antoine, I consider the pure Python implementation to be valuable. Furthermore, the pure Python implementation is the reference, so its behavior is idiomatic.

### Thread safety

AFAIK, there are no thread safety guarantee in OrderedDict. I don't look carefully, but some methods seems thread unsafe.

What isn't thread-safe? I know that Raymond has a good understanding of this area. For instance, he was very clear about re-entrancy concerns when I was working on the C implementation. I recommend getting feedback from him on this. FWIW, I don't recall any bugs related to thread-safety in OrderedDict, even though it's been around a while.

[snip]

### Less maintenance cost of testordereddict. [snip]

I don't find this to be a strong argument. If there are concerns with the reference behavior then those should be addressed rather than used to justify removing the implementation.

### import collections bit faster.

[snip]

This is not a strong argument. The difference is not significant enough to warrant removing the reference implementation.

So, again, I'm against removing the pure Python implementation of OrderedDict. I highly recommend making sure you have Raymond's cooperation before making changes in the collections module.

-eric



More information about the Python-Dev mailing list