79558616

Date: 2025-04-06 19:11:34
Score: 1
Natty:
Report link

So it turns out that defining a and b outside of the __init__ constructor function defines those variables as so-called class variables which are shared across all "instances" (objects) of that class. This does not explain how the values of b are kept separate, but defining a inside of the constructor as self.a = [0, 0] seems to do the trick.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Single line (0.5):
  • Low reputation (0.5):
Posted by: ShadeOfLight