Decorators doubt

Hi,
Didn’t understood anything.
Please explain again.

Decorators are used to make your functions more flexible. By using them, a lot of redundancy is avoided. As I hope in video you have seen that initially we required the add function that takes 4 arguments but later on by using decorators we just passed only the function arguments. It makes our task easy.
In short I just want to say,

  1. Decorators are a way to add functionality to your function without writing the same thing again and again
  2. It makes your work easy and saves memory
  3. As sometimes it’s like you can save a lot of files and memory as you don’t have to write that same redundant functions again and again
    take it like you are calling a function within a function

You can also say that decorator add additional features to an already existing function without changing the function itself .
In decorators, functions are taken as argument into another function .
Eg-

@decorator
def functions(arg):
    return "value"

This is equivalent to -

def function(arg):
    return "value"
function = decorator(function) # this passes the function to the decorator, and reassigns it to the functions

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.