In Java, there's no way to change a static variable (what I thought was more or less the same as a Python class attribute) for just an instance.
In Python, however, I tried the following code in an interactive session:
>>> class TestClass:
... x = 0
...
>>> a = TestClass()
>>> a.x += 1
>>> a.x
1
>>> TestClass.x
0
>>> TestClass.x = 2
>>> a.x
1
>>> TestClass.x
2
Further, I checked the IDs of both a.x and TestClass.x and determined that they weren't equal, so I guessed that there's an instance-level x and a class-level x. Can anyone explain why this is?
I figure the best way to modify a class attribute through an instance through a method that modifies TestClass.x, but I also can't figure out quite why this behavior exists as is.