How Decorators Function | Andrew Knight | Conf42 Python 2022

preview_player
Показать описание
Andrew Knight
Developer Advocate at Applitools

Have you ever seen those ""@"" tags on top of Python functions and classes? Those are called *decorators*. Decorators, in their simplest form, wrap functions around functions. That might sound confusing at first, but it's actually pretty useful. A simple decorator could measure execution times, add startup steps, or automatically repeat calls. Decorators are one of Python's niftiest language features, and they help programmers write DRY (Don't Repeat Yourself) code.

In this talk, we'll learn all about decorators:

1. How they wrap functions
2. How to write our own decorators
3. How to do cool tricks with arguments, classes, and nesting
4. How to use popular decorators
5. How to decide when decorators are (and aren't) the *right* solution

We'll walk through plenty of example code together. We'll also touch lightly on Functional Programming (FP) and Aspect-Oriented Programming (AOP) concepts to build a firm understanding about how decorators work. After this talk, you should be able to use decorators effectively in your own Python projects!



0:00 Intro
0:24 Talk
Рекомендации по теме
Комментарии
Автор

That, ,But wait Theres more" thing is a bit annoying, but overall this video has a very decent content. Thank You. I understand decorators much better now.

palficsaba
join shbcf.ru