Python allows the declaration of functions inside of other functions. Inner functions, also known as nested functions, are defined within a function. This type of function has direct access to variables and names defined in the enclosing function in Python. Inner functions have many uses, most notably as closure factories and decorator functions.
In this course, you’ll learn how to:
- Define inner functions
- Use inner functions as helper functions
- Build function closures
- Use captured variables in a closure
- Use captured data functions in a closure
- Work with decorators
jkueng on July 7, 2021
Very well done and insightful. The background of how inner functions are tied to functional programming really gave me context on why they are important.