PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/speed/test_getattr.py

http://pickled-object-database.googlecode.com/
Python | 14 lines | 9 code | 5 blank | 0 comment | 2 complexity | caa50b7267d1c2b1c6dfdc2b33c05bd2 MD5 | raw file
 1
 2
 3class Thing(object):
 4    
 5    def __init__(self):
 6        self._dirty = {'a': 10}
 7    
 8    def __getattribute__(self, key):
 9        dirty = object.__getattribute__(self,'_dirty')
10        if key in dirty:
11            return dirty[key]
12        else:
13            return object.__getattribute__(self, key)
14