[Python-Dev] PEP 509

Ethan Furman ethan at stoneleaf.us
Tue Jan 12 13:52:24 EST 2016


On 01/12/2016 10:34 AM, Jim J. Jewett wrote:

> (1c)  Section "Guard against changing dict during iteration" says
> "Sadly, the dictionary version proposed in this PEP doesn't help to
> detect dictionary mutation."  Why not?  Wouldn't that mutation involve
> replacing a value, which ought to trigger a version change?


Yes it would, but mutating a dictionary value during iteration is legal, 
so we cannot use the __version__ [1] change to tell us that something 
illegal happened.

[1] We're not going to call it __version__ are we?  Seems like 
__cache_token__ is a much better name.

--
~Ethan~


More information about the Python-Dev mailing list