Python decorator: Example 1
def add_header_footer(func):
def foo1():
print("header")
func()
print("footer")
return(foo1)
@add_header_footer
def foo():
print("plotting code")
>>> foo()
header
plotting code
footer
Comments
Post a Comment