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: 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 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: <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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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