We could introduce parallel kinds of collections:
ValueList/IdentityList, ValueDict/IdentityDict, etc. Ones would use
comparison by value and do not preserve identity (so we could use more
efficient storage for homogeneous collections, for example a list of
small ints could spend 1 byte/item). And others would use comparison by
identity.
IdentityDict was already discussed before. There is a demand on this
feature, but it is not large if keep backward compatibility. There is a
workaround (a dict of id(key) to a tuple of (key, value)), which is not
compatible with IdentityDict, so the latter can be a replacement in a
public API.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/SITZY26MW4LYHB7VN5RVCQZIMYTYHOGM/
Code of Conduct: http://python.org/psf/codeofconduct/