After reading https://stackoverflow.com/a/69067/1767754 I know
1) Static members in Python are not the same Static members in C++
2) Only newly created instances will have the latest Value synced Value of the static Variable
class Test:
var = 3
def __init__(self):
pass
a = Test()
print "a " + str(a.var) #output: 3
Test.var = 5
b = Test()
print "b " + str(b.var) #output: 5
print "a " + str(a.var) #output: 3 not synced with static member
So what is a usual way of sharing member variables between class instances? What about creating a Global Class that holds the shared Data? like that:
class Globals:
var = 3
class Test:
def setVar(self, var):
Globals.var = var
test = Test()
test.setVar(3)
print Globals.var