(This is a newbie Python question)
As I tried the Python decorator with code below, I am a bit puzzled how Python map the Test method name to the parameters at different levels. How does Python know the Test method should be map to name2? Is it because name1 has already been provided with "tom"? But it seems to be a naive reason.
I know the @decorator is just a syntax sugar. What's going on behined the scene?
def level1(name1):
    print("in level1 with %s" % name1)
    def level2(name2):
        print("in level2 with %s..." % name2)
        def level3():
            return "nonthing is done..."
        return level3        
    return level2
@level1("tom")
def Test():
    print("MyClass.Test is callled")
    return "I am Result"
if(__name__ =="__main__"):
    print("Result is: %s" % Test())
The output is:
in level1 with tom
in level2 with <function Test at 0x0000000001DD33C8>...
Result is: nonthing is done...
 
     
    