Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28372

Re: set and dict iteration

From Serhiy Storchaka <storchaka@gmail.com>
Subject Re: set and dict iteration
Date 2012-09-04 00:46 +0300
References (7 earlier) <d4708687-2925-421a-b755-969d6dac731a@googlegroups.com> <mailman.3476.1345328046.4697.python-list@python.org> <mailman.3480.1345343315.4697.python-list@python.org> <c7452db1-5b78-4d54-81a1-1c8683631d6e@googlegroups.com> <CALwzidnV5mFuMMBZi1gyZ954TVu0-8eY-Sir+V+e6x3rDaqq1g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.158.1346708810.27098.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: set and dict iteration Serhiy Storchaka <storchaka@gmail.com> - 2012-09-04 00:46 +0300

csiph-web