Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!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.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'dict': 0.09; 'subject:using': 0.09; 'from:addr:dave': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'code.': 0.20; 'import': 0.21; 'cc:2**0': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "d'aprano": 0.29; 'steven': 0.29; 'yes.': 0.29; 'maybe': 0.29; "skip:' 10": 0.30; 'december': 0.32; 'print': 0.32; 'to:addr :python-list': 0.33; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'your': 0.60; 'header :Message-Id:1': 0.62; 'production': 0.63; 'worth': 0.63; 'me!': 0.84 From: Dave Cinege To: python-list@python.org Subject: Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Date: Tue, 11 Dec 2012 16:08:34 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-686; KDE/4.4.5; i686; ; ) References: <50c6eae2$0$21722$c3e8da3$76491128@news.astraweb.com> In-Reply-To: <50c6eae2$0$21722$c3e8da3$76491128@news.astraweb.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Steven D'Aprano 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355260121 news.xs4all.nl 6976 [2001:888:2000:d::a6]:47547 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34647 On Tuesday 11 December 2012 03:12:19 Steven D'Aprano wrote: > Is this intended as a ready-for-production class? For me, yes. In production code. > py> d = Thesaurus() > py> d['spam'] = {} Maybe because spam is type dict instead of type thes??? >>> import thesaurus >>> thes = thesaurus.Thesaurus >>> t = thes() >>> t.spam = thes() >>> t.spam.ham = 'cheese' >>> print t.spam.ham >cheese >>> print t['spam'].ham >cheese >>> print t['spam']['ham'] >cheese >>> '%(spam.ham)s' % t >'cheese' Works for me! Remainder of your post, not productive, not worth my time. Dave