Revision 643264316633 () - Diff

Link to this snippet: https://friendpaste.com/1cZ2DQRkfIu0CI44oI5i16
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-

class Wrapper(object):

def __init__(self):
self._object = {}

def update(self, **kw):
self._object = kw

def __getattr__(self, attr):
return self._object[attr]

class Test(Wrapper):

def __init__(self):
self._object = {'name': 'toto'}

t = Test()
t.update(name='tata')
print t.name