I have heard that "“Private” instance variables that cannot be accessed except from inside an object don’t exist in Python : as seen here
However, we can create private variables using getter and setter methods in python as seen below
class C(object):
def getx(self):
return self._x
def setx(self, value):
self._x = value
x = property(fset=setx)
c = C()
c.x = 2
print c.x
When I try to access c.x, I am getting the error seen below:
Traceback (most recent call last):
File "d.py", line 12, in <module>
print c.x
AttributeError: unreadable attribute
Does the fact that c.x is not accessible mean that x behaves like a private variable? How does this fact relate to what is said in the link above?