Users Pricing

forum

Home Forums How can I make a chain of function decorators in Python? – MindStick

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

Anonymous User 2869 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.

2 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md