# test_class.py class chair(object): """documentation goes here, many lines OK """ def __init__(self, name, legs=4): # 'self' is a convention, may be any name self.name=name # these are the class data structure self.legs=legs def prnt(self): # may have more arguments print "chair.prnt =", print self.name, self.legs def set(self, newname): self.name=newname def get_legs(self): return self.legs def _cost(self): # should not be used outside return "$"+str(self.legs*5) cost=property(fget=_cost) # cost is now like name and legs chair1=chair("small") # create an instance of a class chair1.prnt() # call a method of the instance chair2=chair("large",6) # create another instance chair2.prnt() chair2.set("large_butt") chair2.prnt() print "legs=", print chair2.get_legs() print chair2.name, chair2.legs, chair2.cost