To say that the decorator has to say the closure function in Python. Refer to the wiki introduction "in Computer science, closures (Closure) are abbreviations for lexical closures (lexical Closure) and are functions that refer to free variables. The referenced free variable will exist with this function, even if it has left the environment that created it. So, there is another saying that closures are entities that are combined by functions and reference environments associated with them. ”
Look, I feel a bit around the mouth, then, as I understand it: a function B in an internal function A that references a variable in the outer scope of B (but not in the global scope), then the internal function B is considered a closure (closure). For example, follow this explanation:
function A has function B, which refers to the x variable in B, where x refers to the deployment global variable x=10, and instead refers to the x=1 in a, then B is a closure function. Run Result:
x=1,y=2
Also, you can see that function B refers to the variable x in a.
Here is just a simple introduction, interested can go to study, next time to say closure of the application---modifiers.