Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36443
| Subject | ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes |
|---|---|
| From | Dave Cinege <dave@cinege.com> |
| Date | 2013-01-08 12:02 -0500 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.284.1357665177.2939.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Thesaurus: A different way to call a dictionary. Thesaurus is a new a dictionary subclass which allows calling keys as if they are class attributes and will search through nested objects recursively when __getitem__ is called. You will notice that the code is disgusting simple. However I have found that this has completely changed the way I program in python. I've re-written some exiting programs using Thesaurus, and often realized 15-30% code reduction. Additionally I find the new code much easier to read. If you find yourself programing with nested dictionaries often, fighting to generate output or command lines for external programs, or wish you had a dictionary that could act (sort of) like a class, Thesaurus may be for you.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Dave Cinege <dave@cinege.com> - 2013-01-08 12:02 -0500
Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes Duncan Booth <duncan.booth@invalid.invalid> - 2013-01-10 11:34 +0000
Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes 88888 Dihedral <dihedral88888@googlemail.com> - 2013-01-10 05:04 -0800
csiph-web