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


Groups > comp.lang.python > #34664

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

From Dave Cinege <dave@cinege.com>
Subject Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes
Date 2012-12-11 18:10 -0500
References <201212102248.50766.dave@cinege.com> <CALwzidnCVaPk2vERU+pPpmp82KAKpiUj-6_5m2Usr9tpatdrCw@mail.gmail.com> <201212111739.12794.dave@cinege.com>
Newsgroups comp.lang.python
Message-ID <mailman.757.1355267415.29569.python-list@python.org> (permalink)

Show all headers | View raw


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.

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


Thread

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Dave Cinege <dave@cinege.com> - 2012-12-11 18:10 -0500

csiph-web