Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39178
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'key.': 0.07; 'though:': 0.07; 'dict': 0.09; 'objects.': 0.09; 'runtime': 0.09; 'assume': 0.11; 'appear.': 0.16; 'effect,': 0.16; 'hashes': 0.16; 'immutable,': 0.16; "key's": 0.16; 'key?': 0.16; 'wrote:': 0.17; 'comparing': 0.17; 'supposed': 0.21; 'keys': 0.22; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'equality': 0.29; 'hash': 0.29; 'key,': 0.29; 'definition': 0.29; 'objects': 0.29; "i'm": 0.29; 'certain': 0.33; 'to:addr:python- list': 0.33; 'equal': 0.33; 'that,': 0.34; 'thanks': 0.34; 'mapping': 0.35; 'pm,': 0.35; "won't": 0.35; 'there': 0.35; 'but': 0.36; 'data.': 0.36; 'subject:with': 0.36; 'should': 0.36; 'does': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'little': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'stay': 0.61; 'time,': 0.62; 'different': 0.63; 'received:74.208': 0.71; 'different.': 0.84; 'received:74.208.4.194': 0.84 |
| Date | Mon, 18 Feb 2013 22:14:05 -0500 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Dictionaries with tuples or tuples of tuples |
| References | <c8abdc96-a47c-462a-9d6e-fcbaad1102fe@googlegroups.com> <mailman.1990.1361237726.2939.python-list@python.org> <3752f235-1542-44c8-b7c7-93dfd98eac3f@googlegroups.com> <dc54beb6-3949-4ab3-9c3d-90d264faa1e2@googlegroups.com> <5122E95B.1070600@lightbird.net> |
| In-Reply-To | <5122E95B.1070600@lightbird.net> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:HI4vQ12SOFjGhfkQOlqC5qgfx2ncYRkaDaxxQQTPaPP yXC0Q8U7hqp24MHHSNLzC4gyEt3GeN6rwGArZZx2T9kPNhyis+ Z1T8MsX5jvzGfdkIQ4lRojqPvuKs0My+DfnrXI4zR1RmFpESSK wUiln8EebnaLednmJQzVjkKyJ3XlMIelX+cXIELYGP85PKaI5q t3vmsfje2DNBoIn+7jUvo7L8u+mnPGLW/kibjZ1Dl/FAn+6Jq2 AwaCxX7ylNsd9v3Qk6s1+nGjhq+H1tiUfzSE8idJycO3mePY1B pz9M4vbldKkiMrB+KY9D/eBjPxbZS3Oe5hjBhMXPU9rgVnwKg= = |
| 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.2002.1361243666.2939.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361243666 news.xs4all.nl 6840 [2001:888:2000:d::a6]:43878 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39178 |
Show key headers only | View raw
On 02/18/2013 09:54 PM, Mitya Sirenef wrote: > On 02/18/2013 09:17 PM, Jon Reyes wrote: >> Thanks Dave and Mitya for enlightening me about dictionaries. I'm >> still confused about this though: > > > > " so that if two > > key objects are equal, they stay equal, and if they differ, they stay > > different. " > > > > What does this mean? I won't be comparing key objects with one > another. Also, when I had two keys with the same value the value of the > other key disappeared so I assume in runtime if there are multiple keys > of the same value only the last one will appear. > > You won't be, but dict will. > > Dict is by definition a mapping where a value is assigned to a unique > key. If you have two keys and two values, and then change one key to > be equal to the second key, that's not kosher, because which value it's > supposed to return when you try to get it by that key? > > So in effect, key's hash value should not change. If key is immutable, > you can be certain that it's hash value will not change. If it's > mutable, you have to make sure not to change the key in a way that'd > make its hash value different than it was. > > -m > It's a little stronger than that, since equal hashes cannot assure equal data. The equality of each object pair in a dict must not change over time, not just the hashes of the individual objects. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 16:52 -0800
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 20:11 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:19 -0800
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:19 -0800
Re: Dictionaries with tuples or tuples of tuples Roy Smith <roy@panix.com> - 2013-02-18 20:17 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:20 -0800
Re: Dictionaries with tuples or tuples of tuples Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-19 01:37 +0000
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:38 -0800
Re: Dictionaries with tuples or tuples of tuples Dave Angel <davea@davea.name> - 2013-02-18 20:51 -0500
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 20:56 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:17 -0800
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 21:54 -0500
Re: Dictionaries with tuples or tuples of tuples Dave Angel <davea@davea.name> - 2013-02-18 22:14 -0500
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 22:56 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:17 -0800
Re: Dictionaries with tuples or tuples of tuples Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-19 02:34 +0000
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:39 -0800
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:39 -0800
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:38 -0800
csiph-web