Python – pretty dictionary access for objects
Instead of hash like access i.e. val = hash['key']
You can achieve a prettier val = obj.key :
class Obj:
..def add(self, k, v):
....self.__dict__[k] = v
o = Obj()
o.add(key, val)
This entry was posted
on Sunday, June 28th, 2009 at 11:07 pm and is filed under Python.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.