I am trying to write a
class and I want that if the initial input values for the class don't obey specific types, it would raise an exception. For instance I would use
except TypeError to return an error. I don't know how it should be done though. My first attempt to write the
class is as following:
class calibration(object): def __init__(self, inputs, outputs, calibration_info, interpolations=2): try: self.inputs=inputs except TypeError self.outputs=outputs self.cal_info=calibration_info self.interpol=interpolations
I would like that if
inputs value is not a string then it raises an error message. I would appreciate for any help.