Author inada.naoki
Recipients inada.naoki
Date 2017-08-23.10:45:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1503485131.2.0.263289319298.issue31265@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2017-08-23 10:45:31inada.naokisetrecipients: + inada.naoki
2017-08-23 10:45:31inada.naokisetmessageid: <1503485131.2.0.263289319298.issue31265@psf.upfronthosting.co.za>
2017-08-23 10:45:31inada.naokilinkissue31265 messages
2017-08-23 10:45:31inada.naokicreate