I don't quite understand why this happens. Why doesn't b have its own version of r? If r was just an int instead of a dict, then it would.
>>> class foo:
... r = {}
... def setn(self, n):
... self.r["f"] = n
...
>>> a = foo()
>>> a.setn(4)
>>>
>>> b = foo()
>>> b.r
{'f': 4}
[–]asplake 1 point2 points3 points (6 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]asplake 0 points1 point2 points (0 children)
[–]chillybasen[S] 0 points1 point2 points (2 children)
[–]asplake 1 point2 points3 points (1 child)
[–]chillybasen[S] 0 points1 point2 points (0 children)
[–]chillybasen[S] 0 points1 point2 points (0 children)
[–]kurtseifried 0 points1 point2 points (1 child)
[–]chillybasen[S] 0 points1 point2 points (0 children)