Understanding decorators [Python tutorial]

  Рет қаралды 27,129

Clear Code

Clear Code

Күн бұрын

Пікірлер: 50
@ghazalehabadian6536
@ghazalehabadian6536 9 ай бұрын
The way you've explained this topic is truly impressive.
@EyadKotb-zf5tf
@EyadKotb-zf5tf 11 ай бұрын
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 2 жыл бұрын
The way you describe concepts it's soo easy too understand, really appreciate your works...
@sachinnerkar9629
@sachinnerkar9629 9 ай бұрын
This is really a master piece . I never visualized the actual flow of decorator anywhere. Thank you very much.
@FitnessChaos
@FitnessChaos 2 жыл бұрын
Finally a good video on decorators
@starshipx1282
@starshipx1282 2 жыл бұрын
Best explanation I ve come across ...
@thecurs3dcreator589
@thecurs3dcreator589 24 күн бұрын
Underrated channel😭🤧 Thanks 🙌
@HowlingDeath
@HowlingDeath Жыл бұрын
For the first time in my life I got to understand decorators cuz of you sir. Thanks a lot
@Chaplainelmo2001
@Chaplainelmo2001 Жыл бұрын
Very logically presented from a senior hobbyist.
@MrSemi-Colon
@MrSemi-Colon 4 ай бұрын
this is a really good tutorial. Its well explained and well thought out. Well done!! :)
@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 2 жыл бұрын
same i've been programming for 3 years n i never used decorators
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
Well try understanding properties and descriptors then. There's something called a descriptor protocol that is very related to how python works internally.
@michaelmueller9635
@michaelmueller9635 Жыл бұрын
Dude, you are describing it so well and brilliant ...that it's really hard and difficult not to understand it 👍
@sonu-jangir
@sonu-jangir Жыл бұрын
Once again, It's a great video on this channel.🎉❤
@ygcjayalal
@ygcjayalal 11 ай бұрын
excellent lesson, very simple and easy to understand. Thank you so much
@csd4ni3l
@csd4ni3l 2 жыл бұрын
yeyyy new video
@fizipcfx
@fizipcfx 2 жыл бұрын
woow i always wondered how decorators can accept parameters, now i got it. i think even procedurally generated decorators are possible
@horaciormartinez1551
@horaciormartinez1551 2 жыл бұрын
Pythontutor is a good help to follow this video
@turtlecode
@turtlecode 2 жыл бұрын
Perfect Tutorial. Thanks
@juicedelemon
@juicedelemon 2 жыл бұрын
wow! that is a lot of tutorials in a month!
@MrMukulpandey
@MrMukulpandey 2 жыл бұрын
Great...keep doing this...your explanation is really great.....u have cleared my OOPs concepts very clearly ❤️
@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 ❤️
@alvarocubi
@alvarocubi 2 жыл бұрын
Thank you for another great tutorial!
@EMRAN994
@EMRAN994 Жыл бұрын
great explanation
@terraflops
@terraflops 2 жыл бұрын
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")
@thecurs3dcreator589
@thecurs3dcreator589 24 күн бұрын
Thanks 🤗
@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.
@ochulorokechukwu1658
@ochulorokechukwu1658 3 ай бұрын
It didnt because `@duration_decorator` is wrapped in the `@duration` decorator due to decorator stacking. Hence what happens is that the `func` in `decorator` function actually invokes the wrapped `duration_decorator ` function. It is the `duration_decorator` function which wraps the `func` function that invokes `func` and thus it outputs `Function` to the terminal. The order of stacking decorators is important with regard to the wrapping. I hope this helps and sorry its coming one year later.
@kyngk
@kyngk 2 жыл бұрын
Can you make a video about async programming with asyncio/await syntax?
@kdpr007
@kdpr007 Ай бұрын
Good video. Very happy I need one clarification: @12.06 min, you mentioned 'I now have a new functionality for this function'. CAn you please tell me which line you are referring to or has the new fn def? Thank you
@M.I.S
@M.I.S Жыл бұрын
very GOOD!
@atharvahode5553
@atharvahode5553 Жыл бұрын
Thanks great video.
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
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.
@mroilatum
@mroilatum 29 күн бұрын
fantastic
@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.
@dingdongkornik9521
@dingdongkornik9521 2 ай бұрын
how if let say i put it in button 1 = original function and in button 2 = decorated function. if i press button 1 the result will be decorated function that is supposed to be original function. does that mean i need to manually remove again the @decorator on top of the original function? because it will effect button 1 if i put @decorator on top of of the original function. newbie here and wanted to learn this confusing decorator 😅. i hope you get what i mean to say. i want it to be. if pres button 1 = original function which print only "original" and if i press 2 = decorated function which prints "start decorated" "original" "end decorated". Thanks. def decoratedfunc(func): def wrapper(): print('start decorated') originalfunc() print('end decorated') return wrapper @decoratedfunc def originalfunc(): print('original') button1 = originalfunc() button2 = originalfunc()
@nursing_father738
@nursing_father738 2 жыл бұрын
Nice explanation. but when I run the same code it gives a type error.. Nonetype error is not callable
@nursing_father738
@nursing_father738 2 жыл бұрын
i fixed it
@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.
@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.
@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.
@tehblocky8067
@tehblocky8067 Жыл бұрын
15:42
@ankitaswal2894
@ankitaswal2894 2 жыл бұрын
Wow
@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.
@hexagerardo
@hexagerardo 5 ай бұрын
I want to obtain an operator / operator(func_in) = func_out func_in(x) func_out(y) def operator(func_in): code return func_out code [Now I need to define func_out with the argument y and in its body I must program a function F( y , func_in )]: def func_out( y ): return F( y , func_in ) Or in lambda calculus: operator = λfunc_in.(λy. F( y , func_in )) \-----------v-----------/ func_out
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 460 М.
Understanding framerate independence and deltatime
29:22
Clear Code
Рет қаралды 44 М.
"Идеальное" преступление
0:39
Кик Брейнс
Рет қаралды 1,4 МЛН
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
Python Decorators: The Complete Guide
27:59
ArjanCodes
Рет қаралды 164 М.
HashMaps & Dictionaries, Explained Simply
22:44
Nic Barker
Рет қаралды 14 М.
Python Object Oriented Programming (OOP) - For Beginners
53:06
Tech With Tim
Рет қаралды 3,5 МЛН
Introduction to shaders: Learn the basics!
34:50
Barney Codes
Рет қаралды 389 М.
Python Generators Explained
28:37
Tech With Tim
Рет қаралды 164 М.
5 Python Libraries You Should Know in 2025!
22:30
Keith Galli
Рет қаралды 89 М.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
threading vs multiprocessing in python
22:31
Dave's Space
Рет қаралды 605 М.
"Идеальное" преступление
0:39
Кик Брейнс
Рет қаралды 1,4 МЛН