AtrributeDict

Дамјан Георгиевски gdamjan at gmail.com
Wed Apr 29 19:09:48 EDT 2009


I've needed an attribute accessible dict, so I created this.
Are there any obviously stupid shortcomings?

class AttrDict(dict):
   def __getattr__(self, name):
       try:
           return self[name]
       except KeyError, e:
           raise AttributeError(e)


-- 
дамјан ( http://softver.org.mk/damjan/ )

Our national drug is alcohol,
we tend to regard the use any other drug with special horror.
    -- William S. Burroughs




More information about the Python-list mailing list