Today i am going to show Programming Tip - How to make a chain of function decorators in Python with simple code. I hope you will understand this.
If you have any query you can ask.
i hope you will like it.
def makebold(fn):
def wrapped():
return "" + fn() + ""
return wrapped
def makeitalic(fn):
def wrapped():
return "" + fn() + ""
return wrapped
@makebold
@makeitalic
def hello():
return "hello world"
print hello()
OUTPUT
<b><i>hello world</i></b>
Follow me at : https://steemit.com/@ahmadhassan
=========================================================