0% found this document useful (0 votes)
6 views1 page

Decorators in Python

A decorator in Python is a function that adds additional functionality to a normal function. It takes a normal function as a parameter and defines an inner function that implements the added functionality. The syntax involves defining the decorator function and the inner function, with the inner function returning the result of its execution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Decorators in Python

A decorator in Python is a function that adds additional functionality to a normal function. It takes a normal function as a parameter and defines an inner function that implements the added functionality. The syntax involves defining the decorator function and the inner function, with the inner function returning the result of its execution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

========================================================

Decorators in Python
========================================================
=>A Decorator is one of the Function which will provide Additional Functionality to
the Normal Function.
=>A Decorator always takes Normal Function as Parameter.
-----------------------------------------------
=>Syntax for Defining Decorator
-----------------------------------------------
def Function-Name1(Formal Parameter for Normal Function): #
Decorator Def OR Outer Function Def.
def Function_Name2(): # Inner Function
--------------------------------
--------------------------------
Block of Statements
provides Addl. Functionality to Normal Function
--------------------------------
--------------------------------
retun result of Function_Name2
return Function_Name2

=>Here Function-Name1 is called Decorator


=>Here Function-Name2 is called Inner Function.
=========================================x=================================

You might also like