- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoratorsExample.py
More file actions
Latest commit
35 lines (25 loc) · 638 Bytes
/
Copy pathdecoratorsExample.py
File metadata and controls
35 lines (25 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
importsys
defmakebold(func):
defwrapped(*args,**kwargs):
return"<b>"+func(*args,**kwargs) +"</b>"
returnwrapped
defmakeitalic(func):
defwrapped(*args, **kwargs):
return"<i>"+func(*args, **kwargs) +"</i>"
returnwrapped
@makebold
@makeitalic
deftext(num,name="hello"):
returnstr(num)+" "+name
printtext(2,name="sam")
sys.exit()
print"-----------------"
deflogger(func):
definner(*args, **kwargs):
print"Argumen" ,args,kwargs
returnfunc(*args, **kwargs)
returninner
@logger
defadd(a,b,c=2,d=3):
return (a,b,c,d)
printadd(1,2,d=222,c=3)