I am trying to learn about static variables in python. According to this answer this piece of code should make i
unique for all the objects of class Test
The code:
>>> class Test(object):
... _i = 3
... @property
... def i(self):
... return self._i
... @i.setter
... def i(self,val):
... self._i = val
...
>>>
>>> x1 = Test()
>>> x1.i
3
>>> x2 = Test()
>>> x2.i
3
>>> x1.i = 10
>>> x1.i
10
>>> x2.i
3
But as you can see object x1.i is not equal to x2.i.
I tried to do this in both python 2.7 and 3.4 but the result is same.
I think my understanding about this concept is wrong.
Could somebody please explain this to me or guide me to a resource.