Skip to content

Commit dc97a52

Browse files
committed
2 parents fca3d21 + 2efc220 commit dc97a52

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

‎decorator.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
'''https://docs.python.org/2/library/functools.html#functools.wraps'''
2-
'''https://stackoverflow.com/questions/739654/how-can-i-make-a-chain-of-function-decorators-in-python/739665#739665'''
1+
"""https://docs.python.org/2/library/functools.html#functools.wraps"""
2+
"""https://stackoverflow.com/questions/739654/how-can-i-make-a-chain-of-function-decorators-in-python/739665#739665"""
33

44
fromfunctoolsimportwraps
55

6+
67
defmakebold(fn):
78
@wraps(fn)
89
defwrapped():
910
return"<b>"+fn() +"</b>"
1011
returnwrapped
1112

13+
1214
defmakeitalic(fn):
1315
@wraps(fn)
1416
defwrapped():
1517
return"<i>"+fn() +"</i>"
1618
returnwrapped
1719

20+
1821
@makebold
1922
@makeitalic
2023
defhello():
21-
'''a decorated hello world'''
24+
"""a decorated hello world"""
2225
return"hello world"
2326

2427
if__name__=='__main__':

‎prototype.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def clone(self, name, **attr):
2323
obj.__dict__.update(attr)
2424
returnobj
2525

26+
2627
classA:
2728
def__init__(self):
2829
self.x=3

0 commit comments

Comments
(0)