Understanding decorators [Python tutorial]

  Рет қаралды 24,812

Clear Code

Clear Code

Күн бұрын

A video on understanding python decorators, including the property decorator in classes.
If you want to support me: / clearcode
(You also get lots of perks)
Social stuff:
Twitter - / clear_coder
Discord - / discord
Timestamps:
00:00 - Intro & Decorator theory
03:34 - Function basics
08:28 - Basic decorator
21:03 - Decorators with function arguments
26:44 - Decorators with parameters
31:48 - Decorators & classes with @property
Project files:
github.com/clear-code-project...
Pastebin
function_basics - pastebin.com/AjSn3hcA
basic_decorator - pastebin.com/NVB8gLfP
decorators_arguments - pastebin.com/wHTrXGd5
decorator_parameter - pastebin.com/JLNecfFs
property_decorator - pastebin.com/bj0bgJKN

Пікірлер: 42
@ghazalehabadian6536
@ghazalehabadian6536 Ай бұрын
The way you've explained this topic is truly impressive.
@EyadKotb-zf5tf
@EyadKotb-zf5tf 3 ай бұрын
You are literally theeee best , now and only I can understand decorators ,I absolutely love your approach of explaining things slowly with pure logic .keep it up!!!!
@durandas6661
@durandas6661 Жыл бұрын
The way you describe concepts it's soo easy too understand, really appreciate your works...
@sachinnerkar9629
@sachinnerkar9629 2 ай бұрын
This is really a master piece . I never visualized the actual flow of decorator anywhere. Thank you very much.
@starshipx1282
@starshipx1282 2 жыл бұрын
Best explanation I ve come across ...
@MrMukulpandey
@MrMukulpandey 2 жыл бұрын
Great...keep doing this...your explanation is really great.....u have cleared my OOPs concepts very clearly ❤️
@alvarocubi
@alvarocubi 2 жыл бұрын
Thank you for another great tutorial!
@michaelmueller9635
@michaelmueller9635 Жыл бұрын
Dude, you are describing it so well and brilliant ...that it's really hard and difficult not to understand it 👍
@lordmahakaal
@lordmahakaal 6 ай бұрын
For the first time in my life I got to understand decorators cuz of you sir. Thanks a lot
@FitnessChaos
@FitnessChaos 2 жыл бұрын
Finally a good video on decorators
@Chaplainelmo2001
@Chaplainelmo2001 10 ай бұрын
Very logically presented from a senior hobbyist.
@fizipcfx
@fizipcfx 2 жыл бұрын
woow i always wondered how decorators can accept parameters, now i got it. i think even procedurally generated decorators are possible
@ygcjayalal
@ygcjayalal 3 ай бұрын
excellent lesson, very simple and easy to understand. Thank you so much
@turtlecode
@turtlecode 2 жыл бұрын
Perfect Tutorial. Thanks
@sonu-jangir
@sonu-jangir 9 ай бұрын
Once again, It's a great video on this channel.🎉❤
@csd4ni3l
@csd4ni3l 2 жыл бұрын
yeyyy new video
@juicedelemon
@juicedelemon 2 жыл бұрын
wow! that is a lot of tutorials in a month!
@YassFreeks
@YassFreeks 2 жыл бұрын
I didn't finish the last video yet, I can't keep up the pace 😫 😪 But thank you so much for this content ❤️
@horaciormartinez1551
@horaciormartinez1551 2 жыл бұрын
Pythontutor is a good help to follow this video
@EMRAN994
@EMRAN994 10 ай бұрын
great explanation
@atharvahode5553
@atharvahode5553 8 ай бұрын
Thanks great video.
@M.I.S
@M.I.S 10 ай бұрын
very GOOD!
@kyngk
@kyngk 2 жыл бұрын
Can you make a video about async programming with asyncio/await syntax?
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
It would be great if you could make a video on the descriptor protocol. Much of how Python works behind the scenes is based on or has something to do with descriptors. I have tried to understand them from many sources but still have not.
@terraflops
@terraflops Жыл бұрын
I went with Star Trek theme for decorators def replicator(function): def food(food_params): print(" replicator() -> food() ") function(food_params) print(" food replicated ") return food @replicator def mealtime(func_params): print(func_params) mealtime("sandwich")
@pranavnyavanandi9710
@pranavnyavanandi9710 Жыл бұрын
A decorator is a higher order function that utilizes the property of closures, and helps dynamically add functionality to a function without altering any of it's own functionality. Learnt this from the great youtuber Corey Schafer.
@Yassinius
@Yassinius 2 жыл бұрын
I've been programming python for 3.5 years and for the time being I got away with never using decorator. Every time I saw someone use decorators it confused me so much. Thanks for explaining a concept that seemed so daunting and making it actually easy :) It's really helpful
@GreenlackX
@GreenlackX 2 жыл бұрын
I See That I Have Bin Coding Now 1.8 Years Of My Life (Python), This Was Really Helpful.
@captain_vegan
@captain_vegan Жыл бұрын
same i've been programming for 3 years n i never used decorators
@pranavnyavanandi9710
@pranavnyavanandi9710 Жыл бұрын
Well try understanding properties and descriptors then. There's something called a descriptor protocol that is very related to how python works internally.
@ankitaswal2894
@ankitaswal2894 2 жыл бұрын
Wow
@fouezdesign
@fouezdesign 2 жыл бұрын
Absolute mind torture.
@akshatsingh3458
@akshatsingh3458 2 жыл бұрын
😂😂😂😂
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
Watch the video by Corey Schafer in his Python OOPS Playlist. That's how I got started with it all. Pretty simple concept once you get the hang of it.
@fouezdesign
@fouezdesign 2 жыл бұрын
@@pranavnyavanandi9710 you're right, with all respect to this guy but no one beats Corey.
@shinobi1975
@shinobi1975 Жыл бұрын
18:31 why didn’t it print “Function” twice??? func() was called once in decorator and duration_decorator wrapper function. Can somebody explain this.
@omerfidan892
@omerfidan892 2 жыл бұрын
if you can make the examples with numbers like, func1 func2, every where you write same name and we strugle to understand whch is what.
@el_munoz
@el_munoz 2 жыл бұрын
Thats a very good explanation about Decorators, but in the class example you forget to change the "self._x" in the __init__ method for "self.x" for avoid self reference.
@nursing_father738
@nursing_father738 Жыл бұрын
Nice explanation. but when I run the same code it gives a type error.. Nonetype error is not callable
@nursing_father738
@nursing_father738 Жыл бұрын
i fixed it
@tehblocky8067
@tehblocky8067 Жыл бұрын
15:42
@ilanlee3025
@ilanlee3025 2 жыл бұрын
Started off well and your explanation is good but the written example is bad and confusing. You should have not named everything func. It is just confusing. You should have named it something else or no one can understand what is the use case. I can delete half this code and func() will still print out the function output.
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 425 М.
Python Decorators: The Secret to Supercharging Your Code
20:53
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 3,1 МЛН
Универ. 13 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:07:11
Комедии 2023
Рет қаралды 4,3 МЛН
Climbing to 18M Subscribers 🎉
00:32
Matt Larose
Рет қаралды 25 МЛН
Python Decorators: The Complete Guide
27:59
ArjanCodes
Рет қаралды 145 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 95 М.
5 Useful Python Decorators (ft. Carberra)
14:34
Indently
Рет қаралды 86 М.
Understanding framerate independence and deltatime
29:22
Clear Code
Рет қаралды 38 М.
Cameras in Pygame
1:13:21
Clear Code
Рет қаралды 113 М.
5 Useful Dunder Methods In Python
16:10
Indently
Рет қаралды 52 М.
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 3,1 МЛН