Why Decorators?
- Speaker
- Dirk Lüdtke
- Date
- Type
- Talk
- Language
- English
- Length
- 30 minutes
About this talk
Python first introduced decorators way back in 2004 with version 2.4, as a powerful tool for enhancing the behavior of functions and (later on) classes all in a neat and concise way. You are probably familiar with some popular decorators like @classmethod, @app.route (Flask), @validator (Pydantic), and @tf.function (TensorFlow). While most of us happily use them, few actually create our own. Decorators are convenient, but they’re not without their quirks. As I write this, I’m still a little on the fence about using them too liberally. But fear not! By the time we get to the talk, I’ll share some intriguing insights, show you where decorators truly shine, and highlight a few hilarious examples of flagrant misuse.