[issue31265] Remove doubly-linked list from C OrderedDict
INADA Naoki
report at bugs.python.org
Wed Aug 23 06:45:31 EDT 2017
INADA Naoki added the comment:
There are some failing tests remaining, and I want to discuss about
some of them here.
Traceback (most recent call last):
File "/home/inada-n/work/python/nodebug/Lib/test/test_ordered_dict.py", line 261, in test_pop
self.assertEqual(m.pop('a', default=6), 6)
TypeError: pop() takes no keyword arguments
dict.pop doesn't take keyword argument.
Since OrderedDict is pure Python at first, C implementation of
OrderedDict.pop() takes keyword too.
May I change `dict.pop()` to take keyword too. It reduce odict
specific method.
Some test expect KeyError in some edge cases.
But new implementation behaves differently.
For example,
def test_dict_delitem(self):
OrderedDict = self.OrderedDict
od = OrderedDict()
od['spam'] = 1
od['ham'] = 2
dict.__delitem__(od, 'spam')
with self.assertRaises(KeyError):
repr(od)
Since current implementation uses linked list, it raises KeyError.
But this is totally OK for new C implementation.
---
Personally speaking, I want to stop keeping compatibility with pure Python
implementation.
Is it possible to make "builtin _collections.OrderedDict" as requirement for
all Python 3.7 implementations and remove pure Python implementation stdlib?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31265>
_______________________________________
More information about the Python-bugs-list
mailing list