0

I am having difficulties in understanding on how inner functions are run in Python. Please have a look at the following snipped of code:

def f(a, b):
    return a + b

def outer(f):
    def inner(x, y):
        if not isinstance(x, int) and not isinstance(y, int):
            raise TypeError('Please provide integer for both arguments')
        return f(x, y)
    return inner

I am just confused about when inner is run and how it returns the function f with inner 's arguments and lastly the return of inner is returning the f.

Can anyone enlighten the way Python interprets the steps when the above code is passed to the interpreter.

Dilshad Abduwali
  • 1,388
  • 7
  • 26
  • 47

0 Answers0