try: result = a / b if math.isnan(result): raise ArithmeticError("Result is NaN. I knew this would happen.")