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


Groups > comp.lang.python > #28726

Re: set and dict iteration

Received by 10.224.28.15 with SMTP id k15mr1559643qac.8.1347118976632; Sat, 08 Sep 2012 08:42:56 -0700 (PDT)
Received by 10.236.75.3 with SMTP id y3mr1371158yhd.20.1347118976574; Sat, 08 Sep 2012 08:42:56 -0700 (PDT)
Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.216.87.MISMATCH!v8no54367qap.0!news-out.google.com!da15ni1572qab.0!nntp.google.com!b19no84242qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sat, 8 Sep 2012 08:42:56 -0700 (PDT)
In-Reply-To <50456073$0$29978$c3e8da3$5496439d@news.astraweb.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=67.184.78.189; posting-account=MQ3pigoAAACeFzUFjVAePnOjOJMNlvq9
NNTP-Posting-Host 67.184.78.189
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> <mailman.3883.1346095064.4697.python-list@python.org> <1567e8c7-a2bb-41f4-9be8-18e9f4d063cb@googlegroups.com> <mailman.154.1346700607.27098.python-list@python.org> <mailman.155.1346702665.27098.python-list@python.org> <504558cb$0$29978$c3e8da3$5496439d@news.astraweb.com> <mailman.162.1346723805.27098.python-list@python.org> <50456073$0$29978$c3e8da3$5496439d@news.astraweb.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <87f103a7-2bbd-405f-8a5e-3aaf02c80fff@googlegroups.com> (permalink)
Subject Re: set and dict iteration
From Aaron Brady <castironpi@gmail.com>
Injection-Date Sat, 08 Sep 2012 15:42:56 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:28726

Show key headers only | View raw


On Monday, September 3, 2012 8:59:16 PM UTC-5, Steven D'Aprano wrote:
> On Mon, 03 Sep 2012 21:50:57 -0400, Dave Angel wrote:
> 
> 
> 
> > On 09/03/2012 09:26 PM, Steven D'Aprano wrote:
> 
> 
> 
> >> An unsigned C int can count up to 4,294,967,295. I propose that you say
> 
> >> that is enough iterators for anyone, and use a single, simple, version
> 
> >> counter in the dict and the iterator. If somebody exceeds that many
> 
> >> iterators to a single dict or set,
> 
> > 
> 
> > I think you have the count confused.  it has to be a count of how many
> 
> > changes have been made to the dict or set, not how many iterators exist.
> 
> 
> 
> Oops, yes you are absolutely right. It's a version number, not a count of 
> 
> iterators.
> 
> 
> 
> 
> 
> -- 
> 
> Steven

Hello.  We have a number of proposed solutions so far.

1) Collection of iterators
  a) Linked list
    i) Uncounted references
    ii) Counted references
    iii) Weak references
  b) Weak set
2) Serial index / timestamp
  a) No overflow - Python longs
  b) Overflow - C ints / shorts / chars
  c) Reset index if no iterators left
3) Iterator count
  - Raise exception on set modifications, not iteration

Note, "2b" still leaves the possibility of missing a case and letting an error pass silently, as the current behavior does.  The rest catch the error 100% of the time.

Anyway, I plan to develop the above patch for the 'dict' class.  Would anyone like to take over or help me do it?

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


Thread

Re: set and dict iteration Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-27 13:17 -0600
  Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-09-02 10:43 -0700
    Re: set and dict iteration Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-03 13:29 -0600
      Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-09-03 13:04 -0700
        Re: set and dict iteration Dave Angel <d@davea.name> - 2012-09-03 16:27 -0400
          Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-09-03 17:24 -0700
          Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-09-03 17:24 -0700
      Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-09-03 13:04 -0700
        Re: set and dict iteration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-04 01:26 +0000
          Re: set and dict iteration Dave Angel <d@davea.name> - 2012-09-03 21:50 -0400
            Re: set and dict iteration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-04 01:59 +0000
              Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-09-08 08:42 -0700
  Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-09-02 10:43 -0700

csiph-web