I\'ve been trying to understand Python\'s handling of class and instance variables. In particular, I found this answer quite helpful. Basically it says that if you declare a
I think you just found a bug in Python there. bar.num += 1 should be an error, instead, it is creating an attribute num in the object bar, distinct from Foo.num.