[Python-Dev] PEP 509: Add a private version to dict (original) (raw)
Glenn Linderman v+python at g.nevcal.com
Wed Jan 20 14:45:42 EST 2016
- Previous message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 1/20/2016 10:36 AM, Maciej Fijalkowski wrote:
Why can't you simply use the id of the dict object as the globally unique >dict ID? It's already globally unique amongst all Python objects which makes >it inherently unique amongst dicts. > >_______________________ >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/fijall%40gmail.com > Brett, you need two things - the ID of the dict and the version tag. What we do in pypy is we have a small object (called, surprisingly, VersionTag()) and we use the ID of that. That way you can change the version id of an existing dict and have only one field. For the reuse case, can't you simply keep the ma_version "live" in dict items on the free list, rather than starting over at (presumably) 0 ?
Then if the dict is reused, it bumps the ma_version, and the fallback code goes on with (presumably) relocating the original dict (oops, it's gone), and dealing with the fallout.
Then you can use the regular dict id as the globally unique dict id?
And only need the one uint64, rather than a separately allocated extra
pair of uint64?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160120/5c1b4ebb/attachment-0001.html>
- Previous message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]