Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Building and accessing an array of dictionaries Date: Fri, 17 Jan 2014 20:53:55 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 29 Message-ID: References: NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1389992035 1244 64.122.56.22 (17 Jan 2014 20:53:55 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Fri, 17 Jan 2014 20:53:55 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:64193 On 2014-01-16, Mark Lawrence wrote: > On 16/01/2014 09:48, Chris Angelico wrote: >> On Thu, Jan 16, 2014 at 8:41 PM, Sam wrote: >>> I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. >>> >>> dict = {'a':'a','b':'b','c':'c'} >>> dict2 = {'a':'a','b':'b','c':'c'} >>> dict3 = {'a':'a','b':'b','c':'c'} >>> >>> arr = (dict,dict2,dict3) >>> >>> What is the syntax to access the value of dict3->'a'? >> >> Technically, that's a tuple of dictionaries > > For the benefit of lurkers, newbies or whatever it's the commas that > make the tuple, not the brackets. In _that_ example, yes. There are other cases where it's the brackets (sort of): foo('a','b','c') # three separate string objects are passed foo(('a','b','c')) # a single tuple object is passed -- Grant Edwards grant.b.edwards Yow! Being a BALD HERO at is almost as FESTIVE as a gmail.com TATTOOED KNOCKWURST.