Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.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.038 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'see:': 0.07; 'subject:using': 0.09; 'failed.': 0.16; 'from:addr:dave': 0.16; 'wrote:': 0.17; 'memory': 0.18; "i'd": 0.22; 'raise': 0.24; 'host': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '[2]': 0.27; 'received:172.30': 0.29; 'sense': 0.31; 'code': 0.31; 'december': 0.32; 'getting': 0.33; 'to:addr:python-list': 0.33; 'there': 0.35; 'but': 0.36; 'charset:us-ascii': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Message-Id:1': 0.62; 'provide': 0.62; 'more': 0.63 From: Dave Cinege To: python-list@python.org Subject: Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Date: Tue, 11 Dec 2012 18:10:08 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-686; KDE/4.4.5; i686; ; ) References: <201212102248.50766.dave@cinege.com> <201212111739.12794.dave@cinege.com> In-Reply-To: <201212111739.12794.dave@cinege.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355267415 news.xs4all.nl 6955 [2001:888:2000:d::a6]:45419 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34664 On Tuesday 11 December 2012 17:39:12 Dave Cinege wrote: My memory is getting jogged more why did some things: raise KeyError(key + ' [%s]' % i) I did this to specificly give you the indice that failed recursion but provide the entire key name as it was provided to __getitem__ So if: g.cfg.host.cpu fails recursion on 'host' you will see: g.cfg.host.cpu [2] I know my code sent g.cfg.host.cpu. I know host failed. if It was g.cfg.host.host, I'd know which host failed. Makes sense to me. Works for me. Sure there are other ways to do it.