Decorators in Python || Python Tutorial || Learn Python Programming

preview_player
Показать описание

Python decorators are "syntactic sugar" that makes it easy to add new features to a function or class without changing its code. To understand decorators, and to write your own, you'll learn how in Python, functions are "first class citizens" and how functions can be nested inside each other. These two features are the essential features that make decorators easy to write and super easy to use.

𝙋𝙧𝙤𝙜𝙧𝙖𝙢𝙢𝙞𝙣𝙜 𝙥𝙡𝙖𝙮𝙡𝙞𝙨𝙩𝙨:

Subscribe to Socratica + bell for notifications:

⧓⧓⧓⧓⧓
We recommend:
How to Be a Great Student

Python Cookbook, 3rd edition

⧓⧓⧓⧓⧓
Join this channel to get access to perks:

Support Socratica on Patreon:

Written & Produced by Michael Harrison
Edited by Megi Shuke and Michael Harrison

#pythontutorial #decorators #coding
Рекомендации по теме
Комментарии
Автор

I’ve been working with Python for over ten years and I have never seen decorators explained so well or so succinctly as here. Really outstanding work. Outstanding.

anthonymunnelly
Автор

This series just keeps on giving, always fun, to the point and beginner friendly. I love your work 🙂

olivierbegassat
Автор

I'm a seasoned programmer but never touch Python. I love this video. The underlying pattern of decorators is universal and this video does a great job explaining it.

JozuaSijsling
Автор

I've only ever had to use a Python decorator to explicitly tag a class method as a property getter or setter. So the "less common" implementation noted in this video is my most common implementation.

ragtop
Автор

Love that Talking Heads "Once in a life time" reference... Thanks Socratica, you're something else...

fvazquez
Автор

This is amazing following your content for the last 3 years Now I'm a middle level backend developer

practicalbong
Автор

“We still had to write throw-away code. That increases my sadness level to 2.9”. Love the super dry computer humor 😂❤

robboerman
Автор

Python programming is FUN!! When I code something in javascript, I remember how much I LOVE Python - the readability of the code is INCOMPARABLY better.
I sometimes struggle to read my javascript code from a few months ago, while with python I don't have that problem, no matter how big is the project. It's just a shame that Python is so slow, often for everything but hobby projects where speed is not important.
Regardless, I will always love Python and he will always be a part of my hobby projects! ❤😄

goranjosic
Автор

Finally I understand decorators. Thanks for sharing!!

hectorherrera
Автор

0:00 Motivation
0:19 Introduction
0:42 Syntax & Types
1:06 Impellation

1:50 Functions: First Class Citizen
2:34 Functions: Nested Definitions
3:04 Segue
3:29 Timer: Manual with timeit.timeit or time.perf_counter
4:00 Timer: Wrapper Function (with *s and **s)
5:35 Timer: Decorator Syntactic Sugar

6:04 Review (with *s and **s)
6:50 functools Module
7:02 cache Decorator
7:52 wrapper Decorator
8:12 Parametric Decorator
8:35 Memoization on Fibonacci

10:11 Review & Conclusion
10:40 Outro

yash
Автор

Thanks for your amazing python tutorial.
I am not a python developer but still watch your videos for the way you deliver these.

nomeshwersharma
Автор

I am totally certain that, none of us will not find a channel on YouTube that let them get the python programming concepts in complete way except this channel, my advice for beginner writes down each code each word had been said in this channel.
Really, I have been fall in love this

amoorinet..
Автор

I am new to Python and enjoyed the video, but I'm not quite ready for this. Looking forward to watching it again when I have a better grasp of the basics. Excited to see there are new videos being created. Thank you for your hard work Socratica team!!

kingofcastlechaos
Автор

I've just found your channel and love it. It's been so helpful to learn python as a beginner, and your examples are very clear and your dry humour is very enjoyable. Can you please explain what *arg and **kwarg means (or point me to a video of yours that explains it)? I've clearly missed this step in my learning process. EDIT: you explained it later in the video. serves me right for commenting midway through. Thanks!!

ow
Автор

I really love this channel. Has been a good companion for years.

cavelinguam
Автор

+12 happiness points for the Talking Heads reference.

Cynthia_Cantrell
Автор

6:00 love it 💜 Best line yet: “That syntactic sugar is definitely sweet.”

cyndicorinne
Автор

These Socratica Python videos are great ! 👍
Keep the excellent work 💪

omarcruz
Автор

It’s super high quality and I would recommend this to anyone

serta
Автор

Great video as always ... and it helps to be a Talking Heads fan to get the ending of the video.

hankblack