class MixedNames: # define class
data = 'spam' # assign class attr
def __init__(self, value): # assign method name
self.data = value # assign instance attr
def display(self):
print self.data, MixedNames.data # instance attr, class attr
x = MixedNames(1) #
y = MixedNames(2) #
x.display()
y.display() # self.data differs, Subclass.data same
|