[Python-Dev] Add reversed methods for dict (original) (raw)
INADA Naoki songofacandy at gmail.com
Sat May 26 10:20:51 EDT 2018
- Previous message (by thread): [Python-Dev] Add __reversed__ methods for dict
- Next message (by thread): [Python-Dev] Add __reversed__ methods for dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Previous message (by thread): [Python-Dev] Add __reversed__ methods for dict
- Next message (by thread): [Python-Dev] Add __reversed__ methods for dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]