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


Groups > comp.lang.python > #28372

Re: set and dict iteration

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'matches': 0.07; 'used.': 0.07; 'created,': 0.09; 'dict': 0.09; 'internally': 0.09; 'oh,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:set': 0.09; 'suggest': 0.11; 'yet.': 0.13; 'advanced,': 0.16; 'increment': 0.16; 'int.': 0.16; 'iterator': 0.16; 'iterator.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.17; 'alternate': 0.17; 'version.': 0.17; 'error.': 0.21; 'raise': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'hash': 0.29; 'modified,': 0.29; 'surprised': 0.29; "i'm": 0.29; 'to:addr:python-list': 0.33; 'version': 0.34; 'table': 0.35; 'received:org': 0.36; 'subject:: ': 0.38; 'store': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'received:46': 0.60; 'strategy': 0.64
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Serhiy Storchaka <storchaka@gmail.com>
Subject Re: set and dict iteration
Date Tue, 04 Sep 2012 00:46:31 +0300
References <b8dd3aca-2a87-4124-ad6e-66a8720af99a@googlegroups.com> <mailman.3389.1345146609.4697.python-list@python.org> <7xy5le7cli.fsf@ruckus.brouhaha.com> <mailman.3404.1345158704.4697.python-list@python.org> <502dab6c$0$29978$c3e8da3$5496439d@news.astraweb.com> <fe95c29c-2289-4e9c-870e-e3c475f13459@googlegroups.com> <mailman.3435.1345240665.4697.python-list@python.org> <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>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 46.185.98.182
User-Agent Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0
In-Reply-To <CALwzidnV5mFuMMBZi1gyZ954TVu0-8eY-Sir+V+e6x3rDaqq1g@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.158.1346708810.27098.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346708810 news.xs4all.nl 6979 [2001:888:2000:d::a6]:40443
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28372

Show key headers only | 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