
On 08.01.16 23:27, Victor Stinner wrote:
Add a new read-only ``__version__`` property to ``dict`` and ``collections.UserDict`` types, incremented at each change.
This may be not the best name for a property. Many modules already have the __version__ attribute, this may make a confusion.
The C code uses ``version++``. The behaviour on integer overflow of the version is undefined. The minimum guarantee is that the version always changes when the dictionary is modified.
For clarification, this code has defined behavior in C (we should avoid introducing new undefined behaviors). May be you mean that the bahavior is not specified from Python side (since it is platform and implementation defined).
Usage of dict.__version__ =========================
This also can be used for better detecting dict mutating during iterating: https://bugs.python.org/issue19332.