ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes
Dave Cinege
dave at cinege.com
Mon Dec 10 22:48:50 EST 2012
More information about the Python-list mailing list
Mon Dec 10 22:48:50 EST 2012
- Previous message (by thread): MySQLdb insert HTML code error
- Next message (by thread): ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. -------------- next part -------------- A non-text attachment was scrubbed... Name: thesaurus.py Type: text/x-python Size: 2912 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-list/attachments/20121210/075bb004/attachment.py>
- Previous message (by thread): MySQLdb insert HTML code error
- Next message (by thread): ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list