I have a class and created its instances a and b. I think both instances points same address.
For example,
class Foo:
counter = 0
def increment():
counter += 1
a = Foo()
b = Foo()
for i in range(10):
a.increment()
b.increment()
aa = a.counter
bb = b.counter
print(aa)
print(bb)
I expected that aa = 10 and bb = 10. However bb = 20 at this point. What am I missing?
incrementisn't a class method andcountershould beself.counter