In Python more than 2.4 functions occasionally see the function definition of the previous line has @functionname modification, clatter this grammatical details, in fact, this is a bit like the C language with the parameters of the macro operation, the interpreter read such a decoration, will first parse the @ after the content, Direct the function or class on the next line of the @ as an argument to the function behind @, and then assign the return value to the function object that is decorated on the next line.
Def Funa (a):
print ' Funa '
def Funb (b):
print ' Funb '
@funA
@funB
def funC ():
print ' FunC 'Result
>>> ================================ Restart ================================
>>>
Funb
Funa
Can think like this, return Funa (Funb (FunC))
See here you see, from the first function modifier start, from the bottom to do parameter transfer, this is actually using the agreed function modifiers to achieve the purpose of nesting functions. I remember that ssh in Java also has this usage oh.