[Python-Dev] Add __reversed__ methods for dict

Guido van Rossum guido at python.org
Sat May 26 13:11:13 EDT 2018


Hm, I find Inada's argument compelling that this might not be easy for all
implementations. So let's wait.

On Sat, May 26, 2018 at 7:20 AM, INADA Naoki <songofacandy at gmail.com> wrote:

> > Concerns have been raised in the comments that this feature may add too
> much
> > bloat in the core interpreter and be harmful for other Python
> implementations.
>
>
> To clarify, my point is it prohibit hashmap + single linked list
> implementation in
> other Python implementation.
> Because doubly linked list is very memory inefficient, every implementation
> would be forced to implement dict like PyPy (and CPython) for efficiency.
>
> But I don't know much about current MicroPython and other Python
> implementation's
> plan to catch Python 3.6 up.
>
> > Given the different issues this change creates, I see three
> possibilities:
>
> > 1. Accept the proposal has it is for dict and dict views, this would add
> about
> > 300 lines and three new types in dictobject.c
>
> > 2. Accept the proposal only for dict, this would add about 80 lines and
> one
> > new type in dictobject.c while still being useful for some use cases
>
> > 3. Drop the proposal as the whole, while having some use,
> reversed(dict(a=1, b=2))
> > may not be very common and could be done using OrderedDict instead.
>
> > What’s your stance on the issue ?
>
>
> I want to wait one version (3.8) for other implementations.
> "Keep insertion order" is requirement from 3.7 which is not released yet.
> I feel it's too early to add more stronger requirements to core type.
>
> Regards,
>
> ---
> INADA Naoki  <songofacandy at gmail.com>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180526/f8a5f6f4/attachment.html>


More information about the Python-Dev mailing list