Avatar ·

Return operator in the Try/Except/Finally block

📁 function, Advanced Python Topics, AI

There is such a function:

   def   f :   try :   1 / 0    except :   return   1    finally :   return   2    3      

when starting it returns 2 , although after the exception it should fall into the except block, where it returns 1 . Why does return not interrupt the function of the function?