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


Groups > comp.lang.python > #28372 > unrolled thread

Re: set and dict iteration

Started bySerhiy Storchaka <storchaka@gmail.com>
First post2012-09-04 00:46 +0300
Last post2012-09-04 00:46 +0300
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#28372 — Re: set and dict iteration

FromSerhiy Storchaka <storchaka@gmail.com>
Date2012-09-04 00:46 +0300
SubjectRe: set and dict iteration
Message-ID<mailman.158.1346708810.27098.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web