Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assign': 0.04; 'cpython': 0.05; 'collections': 0.09; 'tuple': 0.09; 'wrote:': 0.15; '(unlike': 0.16; '3.2.1': 0.16; 'subject: \n ': 0.16; 'subject:database': 0.16; 'subject:wrong': 0.16; 'thunderbird': 0.16; "would've": 0.16; 'static': 0.16; 'pm,': 0.16; 'meant': 0.17; 'received:209.85.210.174': 0.19; 'received:mail- iy0-f174.google.com': 0.19; 'header:In-Reply-To:1': 0.22; 'dictionary': 0.23; 'vs.': 0.23; 'function': 0.26; 'windows': 0.26; 'work.': 0.28; 'id:': 0.29; 'tuples': 0.30; 'class': 0.31; 'subject:?': 0.31; 'values': 0.31; 'named': 0.32; 'chris': 0.32; 'message-id:@gmail.com': 0.32; "i'll": 0.33; 'to:addr:python- list': 0.34; 'header:User-Agent:1': 0.34; 'things': 0.34; 'that,': 0.35; 'module.': 0.35; 'typical': 0.35; 'usage': 0.35; 'but': 0.37; 'received:192': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'received:192.168.1': 0.39; 'sets': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'your': 0.60; 'blank': 0.71; 'factory': 0.73; '5.0': 0.84; 'skip:q 30': 0.84; 'subject:should': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=JHO4BcZATfx3Vpt1xrGB4v2D3PAuxC1Ti6LcGhAq+gk=; b=aVtBffqLS6Y8PyJeIN8T+KM9fQllfdRkM98cvcG1iLvpwI5KCmc4gIaSS0lNP4/M67 vgokmvRR5dkFIvNZDQ09ziohY7nW/kopHK4JqGcWTCrZRkeawWDgHjtLqh3hmUGppdrY i6f2lNU6AsnSELChYn0qmyjSdaSYDsJp7TW1o= Date: Sun, 31 Jul 2011 15:34:22 -0500 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: "comp.lang.python" Subject: Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong? References: <4E35A0BB.5010201@gmail.com> In-Reply-To: X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1312144478 news.xs4all.nl 23961 [2001:888:2000:d::a6]:54665 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10635 On 2011.07.31 02:51 PM, Chris Rebert wrote: > Less punctuation noise: > QueueItem.x264.avs.filter.fft3d.ffte > vs. > QueueItem.x264['avs']['filter']['fft3d']['ffte'] > > It would also make clear that your sets of "keys" are static (unlike > typical dictionary usage). I see what Thorsten meant by "named tuple" now. I was thinking of a tuple with a name: x = (1,2) Your usage made me look it up and I see that it means the factory function in the collections module. I wanted to make things look like that, but the only way I knew how to do that would've been to a new create blank class and assign values to its __dict__. Named tuples look useful; I'll read the docs and see if that will work. -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB