File: class/Workbook/Examples/Lecture12/person.py

# a person object: fields + behavior

class Person:
    def __init__(self, name = '', job = '', pay = 0):
        self.name = name
        self.job  = job
        self.pay  = pay               # real instance data
    def tax(self):
        return self.pay * 0.25        # computed on call
    def info(self):
        return self.name, self.job, self.pay, self.tax()



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