0
How the inner function is executing in this scenario
When I give return Inner statement, how the Inner function is executing ? I didn't give Inner(), I just gave Inner . https://code.sololearn.com/ctcgHUr08B24/?ref=app
4 Réponses
+ 1
Levi
@decor is work like this if you don't write @decor on above the function
def decor(func):
def inner():
print('hello from inner')
return inner
#@decor
def display():
print('Hello')
#display()
r_print = decor(display)
r_print()
------------you can understand by this example------
def abc(func):
def Inner():
print('hello from inner')
return Inner
@abc
def display():
print('Hello')
display()
see I have changed function name here 'abc' and written @abc on above the function display() it means display() function internally call abc function and print statement of abc function
0
A͢J what is r_print()
0
A͢J I can understand ur answer,
But in
return Inner
How the Inner function is executing ?
It should be
return Inner() right !?