forked from driscollis/python201bookcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecorum.py
More file actions
28 lines (21 loc) · 570 Bytes
/
decorum.py
File metadata and controls
28 lines (21 loc) · 570 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
# decorum.py
def another_function(func):
"""
A function that accepts another function
"""
def wrapper():
"""
A wrapping function
"""
val = "The result of %s is %s" % (func(),
eval(func())
)
return val
return wrapper
@another_function
def a_function():
"""A pretty useless function"""
return "1+1"
if __name__ == "__main__":
print(a_function.__name__)
print(a_function.__doc__)