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


Groups > comp.lang.python > #39166

Re: Dictionaries with tuples or tuples of tuples

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'strings.': 0.07; 'python': 0.09; 'immutable': 0.09; 'str,': 0.09; 'language,': 0.11; 'dictionaries': 0.16; 'keys.': 0.16; 'mark.': 0.16; 'simplified': 0.16; 'tuple,': 0.16; 'wrote:': 0.17; 'java': 0.21; 'int,': 0.22; 'keys': 0.22; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; "doesn't": 0.28; 'dictionary': 0.29; 'objects': 0.29; 'class': 0.29; "i'm": 0.29; 'could': 0.32; 'to:addr:python-list': 0.33; 'pm,': 0.35; 'but': 0.36; 'subject:with': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'object': 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; 'received:74.208': 0.71; 'different.': 0.84; 'wow': 0.84
Date Mon, 18 Feb 2013 20:51:50 -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>
In-Reply-To <3752f235-1542-44c8-b7c7-93dfd98eac3f@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:9ztTWElG0vns3Dbfbq/Gkwxm1+1atKpGxCErpy5once LWTQjlqpoEefDObR1qIz6F3K+qupKGBfiKtCiOcWua+q8a2GTH XQznADDIDz4Cb/8LsAQKqEAeOmgiXxwlacrQsiQ1rZXj1NzOwn SzO3cxc1jmgU13xeLM/mjTNUP99D0JTqYCji+kaoTzBRGMSaf2 pdvEZQ/pylQl2ruMxdlcgAZ/EDLJkZvCndgx6tUVEGhjEkwX/+ mjH7lD2uBJQ0zWSELCVvCdTJeZ1FSvrb11U5oTqxFiQ8dzM+a6 pRQPp3XZ3k8pyRbmQQXOH7yJqgmNSpLohUeXfEN3OADa38P3Q= =
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.1994.1361238723.2939.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361238723 news.xs4all.nl 6883 [2001:888:2000:d::a6]:47258
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39166

Show key headers only | View raw


On 02/18/2013 08:38 PM, Jon Reyes wrote:
> Hi Mark. Well, doesn't iteritems() work the same? or am I missing something? By the way I'm sure I read the dictionaries part of Python but I'm unsure if it would take int's as a key for dictionaries. I've been weaned on Java where the keys of hashmaps are always Strings.
>
> PS: Just checked, wow I could use ints as keys. Awesome!
>

The keys to a dictionary may be any immutable type.  That includes str, 
int, and tuple, but it also can include any other class that meets a 
couple of simple criteria.  In simplified language, the only requirement 
is that the key object cannot change its value or hash, so that if two 
key objects are equal, they stay equal, and if they differ, they stay 
different.

-- 
DaveA

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


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