ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes
jeanmichel at sequans.com
Tue Dec 11 11:09:30 CET 2012
----- Original Message -----
> 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
> 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
> a dictionary that could act (sort of) like a class, Thesaurus may be
> for you.
did you know you can write
no = 'Class'
way = 'this'
tc = TestClass()
print "Something you find clean, and I'm not sure why, this is way %(way)s and this is no %(no)s" % vars(tc).
-- IMPORTANT NOTICE:
The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the Python-list