Please explain me decorators in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please explain me decorators in Python

In class subject I didnt understand decorators.Please explain me.

20th Nov 2019, 11:41 AM
Yigit Kerem AKSOY
Yigit Kerem AKSOY - avatar
7 Answers
+ 3
it is a way to add functionality to an existing function without altering the structure of the function
20th Nov 2019, 5:00 PM
Brave Tea
Brave Tea - avatar
+ 1
No I have already complated decorators but i cant understand
20th Nov 2019, 3:10 PM
Yigit Kerem AKSOY
Yigit Kerem AKSOY - avatar
+ 1
Ok what they do
20th Nov 2019, 3:31 PM
Yigit Kerem AKSOY
Yigit Kerem AKSOY - avatar
+ 1
Its like inheriting of a class. But instead, its like inheriting a function. def decor(func): #func param to call the function print(func()) #Prints the retured value of a function @decor def three(): return 3 This might help. I dunno
21st Nov 2019, 8:33 PM
Name Omitted until I come back
+ 1
Ty
22nd Nov 2019, 4:25 AM
Yigit Kerem AKSOY
Yigit Kerem AKSOY - avatar
0
if you go throught the python course here you will be able to your answer. it will take someone of you level about 30 minutes to reach the bit about decorators
20th Nov 2019, 1:55 PM
Brave Tea
Brave Tea - avatar
0
okay. so what is it exactly you don’t understand?
20th Nov 2019, 3:29 PM
Brave Tea
Brave Tea - avatar