Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39175
| 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 | <msirenef@lightbird.net> |
| 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; 'key.': 0.07; 'though:': 0.07; 'dict': 0.09; 'python:': 0.09; 'runtime': 0.09; 'assume': 0.11; 'appear.': 0.16; 'effect,': 0.16; 'immutable,': 0.16; "key's": 0.16; 'key?': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 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; '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; 'thanks': 0.34; 'mapping': 0.35; 'pm,': 0.35; "won't": 0.35; 'there': 0.35; 'but': 0.36; 'subject:with': 0.36; 'should': 0.36; 'does': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'stay': 0.61; 'different': 0.63; 'different.': 0.84; 'hobbies': 0.84 |
| Date | Mon, 18 Feb 2013 21:54:19 -0500 |
| From | Mitya Sirenef <msirenef@lightbird.net> |
| 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> |
| In-Reply-To | <dc54beb6-3949-4ab3-9c3d-90d264faa1e2@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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.2000.1361242467.2939.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361242467 news.xs4all.nl 6843 [2001:888:2000:d::a6]:33247 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39175 |
Show key headers only | View raw
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 -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ Graphic design is the paradise of individuality, eccentricity, heresy, abnormality, hobbies and humors. George Santayana
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