Python Decorators: Gift or Poison?


Follow to receive video recommendations   a   A

Why would you ever need to use decorators in Python?
Have you ever had the task when you need to use one function in few places and you really wanted to avoid of code duplicating? For example to add some logging into functions or timers, etc. Decorators in Python are super powerful with these tasks, but at the same time they are super complicated, sometimes even magical. When I started learning Python, Decorators were really like a magic: how to use them, how are they working, lots of questions. The goal is to make the things easier and clear to answer a question: to use or not to use Decorators in your project.
What’s in the Talk:
- Functions nature in Python
- Magic of a Decorator
- Basics
- When to use Decorators
- Examples
- Even more Python magic

My slides are here:
Code examples:

Editors Note:

If you like this website, please upvote my Awesome Python pull request.