I want some of my class methods to be not re-assignable outside (or both outside and inside) of the class. A's functions are objects too in python, is it possible to accomplish what I want? Here is the method;
def x(self):
"""Return x, the horizontal distance between the shape and the leftmost
of the screen, in pixels.
"""
return self.__x
Now outside of the class, it is easy to mess with this method;
shape = Shape(10, 20)
shape.x = 30
print(shape.x) # Prints 30
print(shape.x()) # TypeError: 'int' object is not callable
Is it possible to prevent this kind of assignment of class methods?