set and dict iteration
Serhiy Storchaka
storchaka at gmail.com
Mon Sep 3 17:46:31 EDT 2012
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.
More information about the Python-list
mailing list