> From Armin Rigo > Sent: Thursday, April 14, 2016 4:42 PM > To: Victor Stinner > Cc: Python Dev > Subject: Re: [Python-Dev] RFC: PEP 509: Add a private version to dict > > Hi Victor, > > On 14 April 2016 at 17:19, Victor Stinner <victor.stin...@gmail.com> wrote: > > Each time a dictionary is created, the global > > version is incremented and the dictionary version is initialized to the > > global version. > > A detail, but why not set the version tag of new empty dictionaries to > zero, always? Same after a clear(). This would satisfy the > condition: equality of the version tag is supposed to mean "the > dictionary content is precisely the same".
>From Victor's original post: "Globally unique identifier is a requirement for Yury's patch optimizing method calls ( https://bugs.python.org/issue26110 ). It allows to check for free if the dictionary was replaced." I think it's a good design idea, and there's no chance that this counter will ever overflow (I think Victor is using 64-bit unsigned integer). I don't think there's really any drawback to using a global vs per-dict counter (but Victor is better placed to answer that :)) -Emanuel ~Ducks lay where no programmer has ever been~ _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com