Jul-24-2020, 09:58 AM
(This post was last modified: Jul-24-2020, 09:59 AM by Gribouillis.)
The effect of the decorator is exactly the same as if you had written
def Divide(a, b): print(a/b) Divide = smartdivide(Divide)So Divide is redefined as the value returned by
smartdivide(Divide)
, that is to say the function errorcheck. Now when you call Divide(), errorcheck() is actually called and it simply returns the value returned by errorcheck(). The effect of returning nothing is only a shorthand for returning the None value. Returning None has no effect with regard to script termination. The script terminates here because there are no other statements.