In Objective-C, the following code appears to be setting myobj.x
to 3:
Foo *myobj = [[Foo alloc] init];
myobj.x = 3;
NSLog(@"%d", myobj.x);
However, it's possible that Foo implements a setter function for x which would intercept this action, setting x to 4, for example. The same goes for reads from x: code that appears to simply be reading the value of x may actually be hitting a getX function in Foo.
Is it possible to do the same in python? When executing the following code:
myobj = Foo()
myobj.x = 3
print myobj.x
Is there some way that myobj.x is actually set to 4? Or is it possible that the print statement displays a 4 due to a nefarious getter implemented in Foo?