New submission from Serhiy Storchaka: For now C implementation of OrderedDict totally overrides Python implementation.
>>> import collections >>> collections.OrderedDict.__init__ <slot wrapper '__init__' of 'collections.OrderedDict' objects> The only way to get Python implementation of OrderedDict is to block the _collections module and reload the collections module. >>> del sys.modules['collections'] >>> del sys.modules['collections.abc'] >>> sys.modules['_collections'] = None >>> import collections >>> collections.OrderedDict.__init__ <function OrderedDict.__init__ at 0xb6f6da4c> But this also blocks collections.deque, collections.defaultdict, and the acceleration of collections.Counter. As long as C implementation of OrderedDict still has some bugs (and I'm not sure we will have fixed all them before releasing 3.5.1), I think it would be good to have a workaround for applications that encounter one of still not fixed bugs. I propose to keep a reference to Python implementation as collections._OrderedDict. This is not a public interface and we don't promise existing this name in future releases. This is just a way to make a workaround for the time while C implementation is not stable enough. I hope we will got rid from it in 3.7. A workaround for an application that suffers from OrderedDict bug: import collections try: collections.OrderedDict = collections._OrderedDict except AttributeError: pass ---------- components: Library (Lib) files: OrderedDict_python_impl.patch keywords: patch messages: 254645 nosy: eric.snow, rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Keep the link to Python implementation of OrderedDict type: enhancement versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file41038/OrderedDict_python_impl.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25623> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com