Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78069
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'allowed.': 0.07; 'class,': 0.07; 'float': 0.07; 'keys,': 0.09; 'matched': 0.09; 'second.': 0.09; 'subject:iterable': 0.09; 'cc:addr:python-list': 0.11; '"""if': 0.16; 'dictionary,': 0.16; 'different?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'intervening': 0.16; 'iterated': 0.16; 'iterating': 0.16; 'iteration': 0.16; 'ought': 0.16; 'so!': 0.16; 'modification': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'cc:addr:python.org': 0.22; 'replace': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; "d'aprano": 0.31; 'division': 0.31; 'sep': 0.31; 'steven': 0.31; 'another': 0.32; 'says': 0.33; 'url:python': 0.33; 'everyone': 0.33; 'fri,': 0.33; 'agree': 0.35; 'definition': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'url:library': 0.38; 'pm,': 0.38; 'sure': 0.39; 'new': 0.61; 'url:3': 0.61; 'first': 0.61; 'guarantee': 0.63; 'between': 0.67; 'subject:there': 0.68; 'url:4': 0.69; 'guaranteed': 0.75; 'subject:check': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=GEkNPw1PGF5/CCJ3ptWpRWtblSifWOXishO2jTu36ec=; b=mAjmX2iGK+zQdM1P0IpnR5ZJi7PyayKIzkEwas4ZVVyMx8ASQUK40NV8Az6qx+D3Kw 2DaPQBJ6oL9PzXyhJQHQAvZ9oSjehXq6waWmSfI5P1r2e85DW59Mo8gUkxgrz9MTl/IU Lt+u3Izx/tjOxIe91KSNlKjL8ZSnvUyVLYbaVH9qJOdmLESWFADpenqw6USbTEtg6Avf veRD9PlkyR7sry+RCfp5UF7VlJf8xNffnC082l0iwnpwWzQ07SuOG14o+cER8S78Q8s7 yxjNuwdJFeqWwbNQQdP/nGW7xpe/C77QEO5vZRe3aL/Pzpgtukb85HiF2PiV7Ka2KPKt 7y3w== |
| MIME-Version | 1.0 |
| X-Received | by 10.51.17.2 with SMTP id ga2mr1414351igd.2.1411125593805; Fri, 19 Sep 2014 04:19:53 -0700 (PDT) |
| In-Reply-To | <541c0c7d$0$29992$c3e8da3$5496439d@news.astraweb.com> |
| References | <efcc61e6-f132-4f14-80b5-0536816b6c7b@googlegroups.com> <mailman.14101.1411042251.18130.python-list@python.org> <roy-E21095.08580518092014@news.panix.com> <541bbbe6$0$29982$c3e8da3$5496439d@news.astraweb.com> <mailman.14134.1411105214.18130.python-list@python.org> <541c0c7d$0$29992$c3e8da3$5496439d@news.astraweb.com> |
| Date | Fri, 19 Sep 2014 21:19:53 +1000 |
| Subject | Re: Is there a canonical way to check whether an iterable is ordered? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14140.1411125602.18130.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1411125602 news.xs4all.nl 2959 [2001:888:2000:d::a6]:37404 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:78069 |
Show key headers only | View raw
On Fri, Sep 19, 2014 at 8:59 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: >> https://docs.python.org/3.4/library/stdtypes.html#dict-views >> """If keys, values and items views are iterated over with no >> intervening modifications to the dictionary, the order of items will >> directly correspond.""" >> So if iterating over d.keys() and then d.values() with no mutations is >> guaranteed to give the same order, then so is iterating over d.keys(), >> then d.keys(), then d.values(), > > Not so! So long as the iteration of values() matched the *second* iteration > of keys(), it would be allowed. There's nothing which says that the first > iteration of keys() has to match the second. I disagree. Between the first iteration of keys() and the iteration of values(), there were no modifications to the dictionary - another iteration over keys() isn't a modification - ergo the guarantee ought to hold. If you replace that inner iteration with the opening of a file, or the division of a float by a Decimal, or the definition of a new class, I'm sure everyone would agree that the guarantee still holds, because they don't change the dict; so why should iterating over keys() be any different? ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there a canonical way to check whether an iterable is ordered? cool-RR <ram.rachum@gmail.com> - 2014-09-18 04:55 -0700
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-18 22:10 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Roy Smith <roy@panix.com> - 2014-09-18 08:58 -0400
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-18 23:33 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Roy Smith <roy@panix.com> - 2014-09-18 19:52 -0400
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-19 12:45 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Terry Reedy <tjreedy@udel.edu> - 2014-09-19 18:02 -0400
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-20 15:01 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Terry Reedy <tjreedy@udel.edu> - 2014-09-18 09:46 -0400
Re: Is there a canonical way to check whether an iterable is ordered? Tim Chase <python.list@tim.thechases.com> - 2014-09-18 09:32 -0500
Re: Is there a canonical way to check whether an iterable is ordered? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-19 15:15 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-19 15:40 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-19 20:59 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-19 21:19 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-19 21:58 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-19 22:06 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-19 21:25 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-19 21:46 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-19 21:56 +1000
Re: Is there a canonical way to check whether an iterable is ordered? alister <alister.nospam.ware@ntlworld.com> - 2014-09-19 12:26 +0000
Re: Is there a canonical way to check whether an iterable is ordered? Chris Angelico <rosuav@gmail.com> - 2014-09-19 22:36 +1000
Re: Is there a canonical way to check whether an iterable is ordered? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-19 15:04 +1000
csiph-web