forum

Home / DeveloperSection / Forums / How can I make a chain of function decorators in Python?

How can I make a chain of function decorators in Python?

Anonymous User 2159 11-May-2015
How can I make two decorators in Python that would do the following?
@makebold
@makeitalic
def say():
   return "Hello"
which should return
<b><i>Hello</i></b>
I'm not trying to make HTML this way in a real application, just trying to understand how decorators and decorator chaining works.

Updated on 01-May-2023
I am a content writter !

Can you answer this question?


Answer

2 Answers

Liked By