#!/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(0.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, length, 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.myset(float(27), float(-27), float(99), "cuisinart") toaster.myprint(); # another interesting way to call a function # print("toaster1...") toaster1 = Toaster(); toaster1.myset(model = "bosch", width=float(99), length=float(35), height=float(27)) toaster1.myprint(); # begin gracefully # if __name__ == "__main__": main(sys.argv[0:]) # # end of file