Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34647

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

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 <dave@cinege.com>
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 <dave@cinege.com>
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 <mailman.705.1355198321.29569.python-list@python.org> <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 <steve+comp.lang.python@pearwood.info>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.743.1355260121.29569.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Dave Cinege <dave@cinege.com> - 2012-12-10 22:48 -0500
  Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-11 08:12 +0000
    Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Dave Cinege <dave@cinege.com> - 2012-12-11 16:08 -0500
      Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-12 06:34 +0000
      Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-12 06:34 +0000
        Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Chris Angelico <rosuav@gmail.com> - 2012-12-12 17:44 +1100
        Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes "D'Arcy J.M. Cain" <darcy@druid.net> - 2012-12-12 05:25 -0500
  Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Dave Cinege <dave@cinege.com> - 2012-12-12 13:13 -0500
  Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-12-12 23:56 +0000
    Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-13 00:15 +0000

csiph-web