File: class/Workbook/Examples/Lecture7/deeperlook.py

class Superclass: pass

class Subclass(Superclass):         # define subclass
    data = 'spam'                   # assign class attr
    def __init__(self, value):      # assign class attr
        self.data = value           # assign instance attr
    def display(self):
        print self.data, Subclass.data     # instance, class

class NextClass:                    # define class
    def printer(self, text):        # define method
        print text



[Home page] Books Code Blog Python Author Train Find ©M.Lutz