Why write a decorator when you can simply write a function? Again,
Passing function as an argument to another function? Are you kidding me.
Maybe the 15th time I look at decorators, it will click. I dunno why it's so hard for me to wrap my head around this one..
Why would I not just write a new function using the old function inside it? What is the benefit of a decorator?
When I introduce decorators in my Python class, It’s often one of the above reactions, and I don’t blame them
Decorators are unique to Python
Passing functions around and treating them like objects isn’t easy to grasp
But oftentimes, what really nails the concept is the use cases. I also showcase famous Python libraries and their famous decorators.
That’s exactly what I tried to do in my recent blog post.
https://www.bhavaniravi.com/python/advanced-python/python-decorators-a-deep-dive
I hope you find this useful. Reply or comment with that Python topic that you find hard to wrap your head around, I’ll create a guide just for you.