I have simple class written
class Test:
stat = 0
def __init__(self):
self.inst = 10
def printa(self):
print Test.stat
print self.inst
Now I've created two object of this class
$ a = Test()
$ b = Test()
When I say a.printa()
or b.printa()
it outputs 0 10
which is understandable.
But when I say
$ a.stat = 2
$ print a.stat
It'll output
2
But when I say a.printa()
It'll output
1
10
What's the difference between saying objInstance.staticVar
and ClassName.staticVar
?? What it is doing internally?