[issue33462] reversible dict

2019-10-19 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +16399 pull_request: https://github.com/python/cpython/pull/16847 ___ Python tracker ___ ___

[issue33462] reversible dict

2018-11-05 Thread INADA Naoki
Change by INADA Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue33462] reversible dict

2018-11-05 Thread INADA Naoki
INADA Naoki added the comment: New changeset 6531bf6309c8fda1954060a0fb5ea930b1efb656 by INADA Naoki (Rémi Lapeyre) in branch 'master': bpo-33462: Add __reversed__ to dict and dict views (GH-6827) https://github.com/python/cpython/commit/6531bf6309c8fda1954060a0fb5ea930b1efb656 -- _

[issue33462] reversible dict

2018-07-21 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi Serhiy and Inada, is there a reason not to move forward with this patch? -- ___ Python tracker ___ __

[issue33462] reversible dict

2018-06-21 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi, is everything good with attached PR or should I refactor it further? -- ___ Python tracker ___ _

[issue33462] reversible dict

2018-06-14 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi, I took a look at the code of OrderedDict it's using the double linked-list to iterate through the items using _odictnode_PREV and _odictnode_NEXT. Since ordereddict needs to support move_to_end that will change the iterating order while dict does not, is it

[issue33462] reversible dict

2018-06-13 Thread Eric Snow
Eric Snow added the comment: Would it be possible to re-use the __reverse__() support that exists for OrderedDict? Doing so could help avoid adding a bunch of duplicated code. -- nosy: +eric.snow ___ Python tracker

[issue33462] reversible dict

2018-06-12 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Thanks INADA, I made the necessary changes to _collections_abc. Is there anything that I should change? -- ___ Python tracker ___ _

[issue33462] reversible dict

2018-06-10 Thread INADA Naoki
INADA Naoki added the comment: My patch was quick and dirty. Please read _collections_abc module and follow the style. (you need to use temporary variables.) And new reviter types can be registered to Iterator ABC too. -- INADA Naoki -- ___ Pytho

[issue33462] reversible dict

2018-06-10 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi INADA thanks for the benchmark, I did both of them too and got the same results (though I had to apply https://github.com/python/performance/pull/41 to get the performance module working). Should I apply your patch in PR 6827? -- __

[issue33462] reversible dict

2018-06-09 Thread INADA Naoki
INADA Naoki added the comment: I confirmed the cost is negligible. python_startup_no_site == Mean +- std dev: [master] 7.31 ms +- 0.39 ms -> [reverse] 7.41 ms +- 0.44 ms: 1.01x slower (+1%) Mean +- std dev: [master] 7.31 ms +- 0.39 ms -> [register] 7.20 ms +- 0.28 ms: 1.

[issue33462] reversible dict

2018-06-09 Thread INADA Naoki
INADA Naoki added the comment: > If adding __reversed__ has any effect on the rest of the build, that is pure > random noise that can be ignored. Although initialization cost of each one type is small, time for _Py_Ready() is not negligible. And ABC.register() too. Import time for _collect

[issue33462] reversible dict

2018-06-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Would you try python_startup and python_startup_nosite benchmark That seems entirely unnecessary. If adding __reversed__ has any effect on the rest of the build, that is pure random noise that can be ignored. It is normal to get small improvements or d

[issue33462] reversible dict

2018-06-09 Thread INADA Naoki
INADA Naoki added the comment: Would you try python_startup and python_startup_nosite benchmark with: * master branch * All reverse iteraters * All reverse iteraters + register them in _collections_abc module -- INADA Naoki -- ___ Python tracker

[issue33462] reversible dict

2018-06-08 Thread Michael Selik
Michael Selik added the comment: It looks like there's general agreement on python-dev that this is appropriate for v3.8 (not v3.7). Guido van Rossum and Ramsey D'silva gave a +1. Raymond Hettinger noted some use cases. INADA Naoki raised a point about waiting for other implementations, whi

[issue33462] reversible dict

2018-05-24 Thread INADA Naoki
INADA Naoki added the comment: > Since there seems to be a consensus about this change being too much, should > we go back to the first proposal to implement dict.__reversed__ only and not > reversed for the views, this would greatly reduce the bload or dump the PR as > a whole ? Since API o

[issue33462] reversible dict

2018-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This would make the feature incomplete and will add a pressure of implementing support for dict views. And even one new type adds much bloat. -- ___ Python tracker ___

[issue33462] reversible dict

2018-05-24 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Since there seems to be a consensus about this change being too much, should we go back to the first proposal to implement dict.__reversed__ only and not reversed for the views, this would greatly reduce the bload or dump the PR as a whole ? -- __

[issue33462] reversible dict

2018-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Inada. It is a "nice to have" feature, but it has too high cost. PR 6827 adds around 300 lines of new code in dictobject.c. Too large for rarely used feature. And dictobject.c is critically important, adding new code here can make the compiler

[issue33462] reversible dict

2018-05-24 Thread INADA Naoki
INADA Naoki added the comment: > Rémi Lapeyre added the comment: > >> I think it's a reasonable expectation as a python user to be able to do reversed(dict(a=1, b=20) since the order is know defined in the specifications. > > I agree about "reasonable expectation". But I'm interested in is i

[issue33462] reversible dict

2018-05-24 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: >> I think it's a reasonable expectation as a python user to be able to do >> reversed(dict(a=1, b=20) since the order is know defined in the >> specifications. > I agree about "reasonable expectation". But I'm interested in is it really > useful in real worl

[issue33462] reversible dict

2018-05-24 Thread INADA Naoki
INADA Naoki added the comment: > I think it's a reasonable expectation as a python user to be able to do > reversed(dict(a=1, b=20) since the order is know defined in the > specifications. I agree about "reasonable expectation". But I'm interested in is it really useful in real world? > It

[issue33462] reversible dict

2018-05-24 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: This change does add built-in types but I think it's a reasonable expectation as a python user to be able to do reversed(dict(a=1, b=20) since the order is know defined in the specifications. It seems inconsistent to have an order on dict, views and not have re

[issue33462] reversible dict

2018-05-24 Thread INADA Naoki
INADA Naoki added the comment: I'm not sure it's worth enough for adding more builtin classes. Adding builtin class means Python interpreter core makes more fat, slow to start, and hard to maintain. -- ___ Python tracker

[issue33462] reversible dict

2018-05-23 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: I updated the pull request, now reversed work on the dict and dict views: ➜ cpython git:(master) ./python.exe Python 3.8.0a0 (heads/master-dirty:128576b88c, May 23 2018, 16:33:46) [Clang 9.0.0 (clang-900.0.39.2)] on darwin Type "help", "copyright", "credits" o

[issue33462] reversible dict

2018-05-17 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi Serhiy Storchaka, I will update the PR to implement this functionality in the views too -- ___ Python tracker ___ __

[issue33462] reversible dict

2018-05-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If implement __reduce__ in dict, it should be implemented in dict views too. -- nosy: +inada.naoki, rhettinger, serhiy.storchaka ___ Python tracker

[issue33462] reversible dict

2018-05-14 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch pull_requests: +6511 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-lis

[issue33462] reversible dict

2018-05-12 Thread Michael Selik
Michael Selik added the comment: 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). -- ___

[issue33462] reversible dict

2018-05-12 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: 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 re

[issue33462] reversible dict

2018-05-10 Thread Raymond Hettinger
Change by Raymond Hettinger : -- versions: +Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue33462] reversible dict

2018-05-10 Thread Michael Selik
New submission from Michael Selik : Now that dicts are tracking insertion order, they can be made reversible via the built-in reversed, just like OrderedDict. -- messages: 316386 nosy: selik priority: normal severity: normal status: open title: reversible dict type: enhancement ___