I thought that if I use "try" and just "finally" else, without any "except", if the "try" statements couldn't be executed, the "finally" statements should be executed, but after that, an error should be shown in the execution, but in this simple code, where purposely I force an invalid operation, errors never jump. Why?
def division_peligrosa(a, b):
try:
a = float(a); b = float(b)
return a/b
finally:
return "Aquí va haber un error..."
print (division_peligrosa(5,0))
print (division_peligrosa("dividendo",28.3))
print ("\nFin del programa, ¡pero nada ocurre!\n")
except: raise
the behavior is the same – Carlo