Decorators provide additional functionality to the functions without directly changing their definition of them. Basically, it takes the functions as an argument, adds functionality to them, and returns it. Before diving deep into the concept of Decorators, let's first try to understand What are functions in Python and what is an inner function? In Python everything is Objects, be it Class, Variables, and Functions . So functions are python first-class objects that can be used or passed as an argument. You can store the functions in variables, you can pass a function to another function as parameters, and you can also return the function from the function. Below is one simple example where we are treating functions as objects . def make_me_lowercase ( str ): return str .lower() print (make_me_lowercase( "HELLO World" )) copy_of_you = make_me_lowercase print (copy_of_you( "HELLO World" )) The output of the above calls for both the functio...
Data Engineering interview preparation with practical insights on SQL, coding, data pipelines, cloud platforms (GCP, AWS), Snowflake, dbt, Fivetran, and AI-driven data systems. This Blog is based on real-world and personal experiences.