The following raises an AttributeError: 'objval' object has no attribute 'testitem'
class objval(object):
def __init__(self):
self.testitem = 1
def __setattr__(self, key, value):
print('setattr: ' + str(key) + '=' + str(value))
testobj = objval()
print(testobj.testitem)
All though when removing def __setattr__(self, key, value): printing testobj.testitem now properly outputs the value.