classification
Title: reversible dict
Type: enhancement Stage: patch review
Components: Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: inada.naoki, remi.lapeyre, rhettinger, selik, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-05-11 03:30 by selik, last changed 2018-05-17 12:34 by remi.lapeyre.

Pull Requests
URL Status Linked Edit
PR 6827 open python-dev, 2018-05-14 19:50
Messages (5)
msg316386 - (view) Author: Michael Selik (selik) * Date: 2018-05-11 03:30
Now that dicts are tracking insertion order, they can be made reversible via the built-in reversed, just like OrderedDict.
msg316436 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2018-05-12 20:47
Hi, I'm taking a look this issue, it look like a new type `PyDictRevIterKey_Type` needs to be defined with its associated methods. I will try to implement the modifications ; this is the first time i'm taking a dive in Python's internals so I can't guarantee results on this but will try nonetheless.
msg316437 - (view) Author: Michael Selik (selik) * Date: 2018-05-12 20:59
Right, a blend of the code from dictiterobject (https://github.com/python/cpython/blob/master/Objects/dictobject.c#L3309) and listreviterobject (https://github.com/python/cpython/blob/master/Objects/listobject.c#L3128).
msg316789 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-16 08:53
If implement __reduce__ in dict, it should be implemented in dict views too.
msg316922 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2018-05-17 12:34
Hi Serhiy Storchaka, I will update the PR to implement this functionality in the views too
History
Date User Action Args
2018-05-17 12:34:42remi.lapeyresetmessages: + msg316922
2018-05-16 08:53:32serhiy.storchakasetnosy: + serhiy.storchaka, inada.naoki, rhettinger
messages: + msg316789
2018-05-14 19:50:51python-devsetkeywords: + patch
stage: patch review
pull_requests: + pull_request6511
2018-05-12 20:59:49seliksetmessages: + msg316437
2018-05-12 20:47:38remi.lapeyresetnosy: + remi.lapeyre
messages: + msg316436
2018-05-11 04:11:39rhettingersetversions: + Python 3.8
2018-05-11 03:30:18selikcreate