class test(object):
    d = 0

def __init__(self):
    type(self).d = self.d + 1
D = test()
print(D.d)
D1 = test()
print(D1.d)
D2 = test()
print(D2.d)
Class variable Vs. Instance variable in python for int value