Comment

Anonymous

another implementation, but allows more than one mapping in the creator, also less restrictive with what it can be updated from:

class SmartDict(dict):

....def __init__(self, *a, **kw):

........super(SmartDict, self).__init__(**kw)
........for x in a:
............try:
................self.update(x)
............except TypeError:
................self.update(x.__dict__)
........self.__dict__ = self