Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27214
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| 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; '16,': 0.03; 'argument': 0.04; 'interpreter': 0.04; '(python': 0.05; '(especially': 0.07; 'python': 0.09; 'deletion': 0.09; 'dict': 0.09; 'enormous': 0.09; 'errors,': 0.09; 'insertion': 0.09; 'sake': 0.09; 'subject:set': 0.09; 'typeerror:': 0.09; 'def': 0.10; "wouldn't": 0.11; 'aug': 0.13; 'all).': 0.16; 'foo(object):': 0.16; 'iterating': 0.16; 'iterator.': 0.16; 'iterators': 0.16; 'low-level': 0.16; 'set,': 0.16; 'there?': 0.16; 'unbound': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'thu,': 0.17; 'typing': 0.17; '>>>': 0.18; 'developer': 0.19; '"",': 0.22; 'header:In-Reply-To:1': 0.25; '(which': 0.26; '(most': 0.27; 'checking': 0.27; 'mix': 0.27; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'shoot': 0.29; 'case,': 0.29; 'class': 0.29; "i'm": 0.29; "we're": 0.30; 'error': 0.30; 'file': 0.32; 'suggestion': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'changed': 0.34; 'received:google.com': 0.34; 'self': 0.34; 'doing': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'expensive': 0.36; 'method': 0.36; 'too': 0.36; 'enough': 0.36; 'does': 0.37; 'level': 0.37; 'why': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'tracking': 0.61; 'first': 0.61; 'between': 0.63; 'more': 0.63; 'honest': 0.75; 'low': 0.83; 'glad': 0.86; 'angel': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=I1Mib2sdHVyBXCW0c0pjSifIXBgBq4uQ//nOoro+kzM=; b=tEGLkx3JTZkUDmv7wm3Y/+WF+8ee5xsD+yhHRNJRD63pai81cQxwHMoBT+C8C3noZj tM1yhkDuKBayWlSvDB69Os3PXMLMpP1pq3Jy6pfclKGa9CmYUMI2lNfbbkGaBTXPdovX yVN0WAhMeVyqRyiVNBumKvSmVUMw3Rogo+YsZIAgY5rcEkO5r90yhZsmiSYZSnPD8p5j R4J3A2t9xpS8YeB7LTpJ2nhX9G34nFkQgszgadCPFs5Qu4RtHAYCqTolzmLwlU82fTY/ xEIb+jjMgj3CipS83NXXWpDOSzGRkcf6UZkXGqkAmRGI5Nl3t+riQ11JYtc2NAqUlL+m QTdA== |
| MIME-Version | 1.0 |
| In-Reply-To | <502D7E17.1070103@dejaviewphoto.com> |
| References | <b8dd3aca-2a87-4124-ad6e-66a8720af99a@googlegroups.com> <mailman.3389.1345146609.4697.python-list@python.org> <7xy5le7cli.fsf@ruckus.brouhaha.com> <502D7E17.1070103@dejaviewphoto.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Thu, 16 Aug 2012 17:43:55 -0600 |
| Subject | Re: set and dict iteration |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.3405.1345160667.4697.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1345160667 news.xs4all.nl 6884 [2001:888:2000:d::a6]:58209 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:27214 |
Show key headers only | View raw
On Thu, Aug 16, 2012 at 5:11 PM, Dave Angel <davea@dejaviewphoto.com> wrote: > There's an enormous difference between type errors, which affect the low > level dispatch, and checking for whether a dict has changed and may have > invalidated the iterator. If we were really going to keep track of what > iterators are tracking a given dict or set, why stop there? Why not > check if another process has changed a file we're iterating through? Or ... How does this affect low-level dispatch (Python 2.7)? >>> class Foo(object): ... def bar(self): ... return self ... >>> Foo().bar() <__main__.Foo object at 0x00CBEAB0> >>> Foo.bar(Foo()) <__main__.Foo object at 0x00CC9390> >>> Foo.bar(object()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unbound method bar() must be called with Foo instance as first argument (got object instance instead) There is no low-level need for this TypeError -- it's purely a case of not letting the developer shoot himself in the foot. Although to be honest the interpreter doesn't give quite enough rope (to mix metaphors) in this case, and I'm glad for the sake of duck typing that they removed this particular error in Python 3. With regard to key insertion and deletion while iterating over a dict or set, though, there is just no good reason to be doing that (especially as the result is very implementation-specific), and I wouldn't mind a more complete low-level check against it as long as it's not too expensive (which is not clearly the case with the current suggestion at all).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-16 11:00 -0700
Re: set and dict iteration Dave Angel <d@davea.name> - 2012-08-16 15:49 -0400
Re: set and dict iteration Paul Rubin <no.email@nospam.invalid> - 2012-08-16 14:26 -0700
Re: set and dict iteration Dave Angel <davea@dejaviewphoto.com> - 2012-08-16 19:11 -0400
Re: set and dict iteration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-17 02:24 +0000
Re: set and dict iteration Paul Rubin <no.email@nospam.invalid> - 2012-08-16 19:30 -0700
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-17 11:11 -0700
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-17 11:37 -0700
Re: set and dict iteration Chris Angelico <rosuav@gmail.com> - 2012-08-18 07:57 +1000
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-18 13:29 -0700
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-18 13:29 -0700
Re: set and dict iteration MRAB <python@mrabarnett.plus.com> - 2012-08-18 23:14 +0100
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-18 19:28 -0700
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-23 09:49 -0700
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-23 09:49 -0700
Re: set and dict iteration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-23 18:11 +0000
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-18 19:28 -0700
Re: set and dict iteration Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-16 17:43 -0600
Re: set and dict iteration Paul Rubin <no.email@nospam.invalid> - 2012-08-16 18:01 -0700
Re: set and dict iteration Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-17 13:16 +0200
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-17 11:03 -0700
Re: set and dict iteration Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-16 16:55 -0600
Re: set and dict iteration Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-16 17:07 -0600
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-17 10:47 -0700
Re: set and dict iteration Aaron Brady <castironpi@gmail.com> - 2012-08-17 10:47 -0700
csiph-web