On 27.08.12 22:17, Ian Kelly wrote:
May I suggest an alternate approach? Internally tag each set or dict with a "version", which is just a C int. Every time the hash table is modified, increment the version. When an iterator is created, store the current version on the iterator. When the iterator is advanced, check that the iterator version matches the dict/set version. If they're not equal, raise an error.
Oh, I'm surprised that this strategy is not used yet. I was sure that it is used.
-- http://mail.python.org/mailman/listinfo/python-list