Загрузка страницы

How to use Decorators in Python - Get Started Here!

Get start with decorators in Python in 10 minutes with this video right now. There are many similar definition of what is a decorator in Python. Some of these are:
- A decorator in Python is a function that takes another function and extends the behavior of the latter function without explicitly modifying it.
- A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate.

There are also many reasons why you should use decorators in your complex Python codes. One of these reasons is improve your Python code debugging capabilities. Second reason is make changes in your Python codes with minimal time costs. Also, you can add temporary functionality to your Python functions for very specific needs (adding extra behavior on the top of existing functions).

Many says that a skill of knowing and applying decorators in real life project is a criterion which allows to recognize senior Python developers from juniors ones. One the other hand, if you want to improve your Python coding skills, decorators are one of must be points you should keep in mind to cover.

To make your decorators a powerful tool in your coding routine, you should also use wargs and kwargs (key arguments) together with your Python decorators, for example to add arguments to your decorators from outside.

The content of this video lesson is:
0:00 - Intro and main definitions of Python decorators
0:58 - Part 1: a null decorator
2:18 - Part 2: decorators can modify behavior
4:11 - Part 3: multiple decorators for a single function
6:18 - Part 4: decorating functions that accepts arguments (wargs and kwargs)
8:23 - Part 5: debuggable decorators

This tutorial is based on this blog post: https://dbader.org/blog/python-decorators
Perfect introducing into Python decorators!

So, basically, with this video I wanted to demonstrate how decorators can benefit you in your day-to-day work as a Python developer from a technical point of view. So, hands-on on this, and let's go!

#python #decorators #kwargs

Видео How to use Decorators in Python - Get Started Here! канала Data Science Garage
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
12 августа 2021 г. 3:16:34
00:10:04
Яндекс.Метрика