On Thu, 30 Jul 2020 at 23:42, Steven D'Aprano <st...@pearwood.info> wrote:

> Of course anything is possible in theory, but I think that would require
> shifting the existing keys and values in the array, and updating the
> entries in the hash table to point to their key in the new position, and
> probably other complications I haven't thought of.
>

Also list must shift the internal array. You don't have to update the
hashtable. For example, when you pop an item, the key is not removed from
the hashtable completely, but it's marked as dummy.

I think the main problem here is set, since set is not ordered. In theory,
dict views could be an "ordered" set, so you can do:

d.keys()[5]
d.values()[1:]
d.items()[3] = "omg"

In any case, if people want to propose turning dicts into fully-fledged
> reorderable, slicable sequences as well as mappings, they will probably
> need a PEP :-)
>

I'm just brainstorming. Not sure about the real use-case.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EF3FRDGV5DPTEIFY2DVRTAMEUUSOEFV7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to