What is a decorator in Python?

Опубликовано: 13 Июнь 2022
на канале: Python Morsels
572
33

A decorator is a callable (usually a function though sometimes a class) that accepts either a function or a class and returns a new function or class that wraps around the original one.

Read an article version of this video at https://pym.dev/what-is-a-decorator/

Find more Python screencasts at https://pym.dev/screencasts/

00:00 Decorators accept a function and return a function
01:30 The decorator syntax: using the @ symbol to apply decorators
02:42 Decorator functions, decorator classes, function decorators, and class decorators
03:06 Decorators can be implemented using classes too
03:45 Class decorators decorate classes
04:23 Recap


На этой странице сайта вы можете посмотреть видео онлайн What is a decorator in Python? длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Python Morsels 13 Июнь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 572 раз и оно понравилось 33 зрителям. Приятного просмотра!