#!/usr/bin/env python # import system modules # import os import sys # Class: Toaster # # This class facilitates handling a parameter file that controls # how many sweeps are done to generate a det curve. # class Toaster: # define a constructor # def __init__(self): self.height_d = [] self.width_d = float(27.0) self.length_d = float(0.0) self.models_d = [] # end of constructor # method: print stuff # # arguments: none # # return: values are printed to stdout # def myprint(self): # print the data # print("height = ", self.height_d) print("width = ", self.width_d) print("length = ", self.length_d) print("models = ", self.models_d) # exit gracefully # return # end of function # method: set stuff # # arguments: height, width, length # # return: none # def myset(self, height = [], width=99, length=99, model=[]): # set the data # self.height_d.append(height) self.width_d = width self.length_d = length self.models_d.append(model) # exit gracefully # return # end of function # end of class # main program # def main(argv): # declare parameters # toaster = Toaster() toaster1 = Toaster() # set some values # print("toaster...") toaster.myset(float(27), float(-27), float(99), "bosch") toaster.myprint() #toaster.myset('Joe', float(-27), float(99), float(27.0)) #toaster.myset(float(27), float(-27), float(99), "cuisinart") print("toaster (2)...") toaster.myprint() # another interesting way to call a function # print("toaster1 (2)...") toaster1.myset(model = "bosch", width=float(99), length=float(35), height=float(27)) toaster1.myprint() print("toaster1 (3)...") toaster1.myset(model = "joe") toaster1.myset(width=float(99), model = "bosch", height=float(27), length=float(35)) toaster1.myprint() # begin gracefully # if __name__ == "__main__": main(sys.argv[0:]) # # end of file