class attrdict(dict):

    def __init__(self, *args, **kwargs):
        dict.__init__(self, *args, **kwargs)
self.__dict__ = self
a = attrdict(x=1, y=2)
print(a.x, a.y)
print(a['x'], a['y'])
b = attrdict()
b.x, b.y = 1, 2
print(b.x, b.y)
print(b['x'], b['y'])
JavaScript-like Object in Python standard library?