On 04/15/2016 01:41 PM, Victor Stinner wrote:
2016-04-15 19:54 GMT+02:00 Jim J. Jewett:
(2) Why *promise* not to update the version_tag when replacing a value with itself?
It's an useful property. For example, let's say that you have a guard on globals()['value']. The guard is created with value=3. An unit test replaces the value with 50, but then restore the value to its previous value (3). Later, the guard is checked to decide if an optimization can be used.
I don't understand -- shouldn't the version be incremented with the value was replaced with 50, and again when re-replaced with 3?
(6) I'm also not sure why version_tag *doesn't* solve the problem of dicts that fool the iteration guards by mutating without changing size ( https://bugs.python.org/issue19332 ) ... are you just saying that the iterator views aren't allowed to rely on the version-tag remaining stable, because replacing a value (as opposed to a key-value pair) is allowed?
If the dictionary values are modified during the loop, the dict version is increased. But it's allowed to modify values when you iterate on *keys*.
I don't understand. Could you provide a small example? -- ~Ethan~