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
from functools import wraps
55

6+
67
def makebold(fn):
78
@wraps(fn)
89
def wrapped():
910
return "<b>" + fn() + "</b>"
1011
return wrapped
1112

13+
1214
def makeitalic(fn):
1315
@wraps(fn)
1416
def wrapped():
1517
return "<i>" + fn() + "</i>"
1618
return wrapped
1719

20+
1821
@makebold
1922
@makeitalic
2023
def hello():
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
return obj
2525

26+
2627
class A:
2728
def __init__(self):
2829
self.x = 3

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy