File tree 1 file changed +13
-7
lines changed
1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 4
4
5
5
"""
6
6
7
+
7
8
# First example
8
9
def outerfunction (outer ):
10
+ print ("test" )
9
11
def innerfunction (inner ):
10
12
return outer (inner ) + 1
11
13
return innerfunction
12
14
15
+
13
16
@outerfunction
14
17
def addone (x ):
15
18
return x + 1
16
19
20
+
17
21
# Second Example
18
22
def wrapfunction (fn ):
19
- print ("Executing wra_function" )
23
+ print ("Executing wrapfunction" )
24
+
20
25
def wrappedfunction ():
21
26
print ("Calling %s inside wrappedfunction" % fn .__name__ )
22
27
# calling fn
23
28
fn ()
24
29
print ("Executed %s inside wrappedfunction" % fn .__name__ )
25
30
return wrappedfunction
26
31
32
+
27
33
@wrapfunction
28
34
def tobedecorated ():
29
35
print ("Executing tobedecorated function" )
30
36
31
37
if __name__ == "__main__" :
32
-
33
- pass
34
- #first example
35
- #print(addone(5))
36
- #second example
37
- # tobedecorated()
38
+
39
+ # pass
40
+ # first example
41
+ # print(addone(5))
42
+ # second example
43
+ tobedecorated ()
You can’t perform that action at this time.
0 commit comments