PLEASE Use These 5 Python Decorators

  Рет қаралды 78,841

Tech With Tim

Tech With Tim

Күн бұрын

In this tutorial, I'll be unveiling 5 essential Python decorators that every programmer should have in their toolkit. If you're wondering what decorators are and how they can supercharge your Python code, you're in the right place. Throughout this video, I'll dive deep into the world of decorators, explaining their fundamental principles and showcasing real-world examples of how they can streamline your code and make it more efficient.
If you want to land a developer job check out my program with Course Careers: techwithtim.net/dev
Skool community for free resources: www.skool.com/software-develo...
Discord server: / discord
🎞 Video Resources 🎞
Python Decorators Tutorial: • Expert Python Tutorial...
Python Dataclasses Tutorial: • Python Data Classes Ar...
⏳ Timestamps ⏳
00:00 | What Is A Decorator?
05:30 | What You NEED To Know
06:14 | @property
10:34 | @staticmethod
12:10 | @classmethod
13:45 | @functools.cache
17:09 | @dataclass
Hashtags
#TechWithTim
#PythonDecorators
#PythonProgramming
#CodingTips

Пікірлер: 55
@TechWithTim
@TechWithTim Ай бұрын
If you’re serious about becoming a developer in 2024 check this out: techwithtim.net/dev
@pietrovalentinoyannellihan3883
@pietrovalentinoyannellihan3883 Ай бұрын
Hello, sorry to put this comment here but i need help with my flask app, im trying to put my app in an Ubuntu server but im using plesk, i already followed your instructions in your video about It but It doesnt work, this is my first website so im clueless and i would really appreciate some help
@kameroongod
@kameroongod Ай бұрын
The more I learn the more I realize I know nothing lol. Keep up the content. Few channels that gets me listening to tutorial videos in my spare time just for fun lol.
@franco-gil
@franco-gil Ай бұрын
The more you learn, the more you can assist others, keep learning new things. A secret, replicate all the content you are trying to learn, you will understand in a more easy way.
@rebukx2
@rebukx2 Ай бұрын
So excited to watch this!!
@alimihakeem841
@alimihakeem841 Ай бұрын
I love your content Tim. Keep it up. I have really learnt alot from you. I see as you as my role model
@neurooted
@neurooted 25 күн бұрын
Keep it up Tim! Very very high quality video.
@samukaze5810
@samukaze5810 Ай бұрын
Tech With Tim I love your informative videos!
@Al_Miqdad_
@Al_Miqdad_ Ай бұрын
cool information thank you ❤❤
@Musaafir-ln6feet
@Musaafir-ln6feet Ай бұрын
Nice can you also cover descriptors and Enums in detail they improve on dataclass.
@Abdullo_1124
@Abdullo_1124 Ай бұрын
Thank you bro
@mattmarshall1834
@mattmarshall1834 12 күн бұрын
The functools cache speeding up the Fibonacci func is crazy. I know how it works but it's still crazy to see.
@BobbyConquest
@BobbyConquest 27 күн бұрын
15:41 how do you type/ make those lines in the comment? Super clean. Love all your videos Tim, you have a gift for teaching
@hieu8276
@hieu8276 Ай бұрын
Nice video. It enhances my belief that freshers should start with C++ or Java. Understanding the decorator, design patterns, static vs class methods, access control, and other OOP concepts makes people write better Python code. Starting with Python should only work for non-IT who need to function quickly.
@blazkowicz666
@blazkowicz666 6 күн бұрын
You are right. I feel in school or college, people should really try to learn: C to learn how a computer actually works Java to really understand OOP, Generics, Reflection etc. And C++ to implement concepts learnt from C and Java to create performant software
@sinaorojlo5980
@sinaorojlo5980 Күн бұрын
Awsome 🎉🎉❤
@DrDeuteron
@DrDeuteron 4 күн бұрын
I like functool's total_ordering decorator.
@sanukyadav
@sanukyadav 14 күн бұрын
7.18 using '_' single underscore represents protected item not private, "__" this is private.
@abdallahbabeker3324
@abdallahbabeker3324 Ай бұрын
Thanks for the video ❤ what's the name of your theme in vs code
@TechWithTim
@TechWithTim Ай бұрын
Monokai
@davidmurphy563
@davidmurphy563 Ай бұрын
Ok, we've got python decorators - but when are we getting python painters?
@grmrcy
@grmrcy Ай бұрын
Loved the video, but with all due respect: there is an error in the Fibonacci code. For initial conditions it should be if n < 2, return 1 (not n, as it will return 0 for n=0, but fibonacci(0) should be 1)
@sri_harsha_dv
@sri_harsha_dv Ай бұрын
It all depends on how you want to start the fibonacci series. Series can either start with (0,1) or (1,1) or (1,2), all of them lead to same sequence starting at different positions. And the time complexity barely changes.
@Abdullo_1124
@Abdullo_1124 Ай бұрын
plz make a pygame full course video
@Balkac
@Balkac Ай бұрын
This cache decorator!
@anubhav12qw
@anubhav12qw Ай бұрын
Nice video bro 😊
@TechWithTim
@TechWithTim Ай бұрын
Thanks 😁
@franco-gil
@franco-gil Ай бұрын
[9:02] zero is not a positive number, it is a neutral number, you should improve the ‘if’ statement, nice video 👋
@cfwebdeveloper
@cfwebdeveloper Ай бұрын
May we use setter/getter in django? Probably yes? If using models can this be used? Maybe as custom validators probably? My brain just wrote this out lol but seems feasible?
@DrDeuteron
@DrDeuteron 4 күн бұрын
what do you mean getters/setter? property and property().setter, yes, but if you're writing methods called set_radius(self, radius) or get_radius(self), then no. Never. It's not java.
@cfwebdeveloper
@cfwebdeveloper 4 күн бұрын
@@DrDeuteron Totally agree. I also don't touch Java, ever lol
@DrDeuteron
@DrDeuteron 4 күн бұрын
omg, I was on a NASA code project and it was full of: space_craft . get_intrument() . get_sensor . get_channel() . get_shelves() . get_shelf() . get_temperature() (and setters like that!) calls, and the 1st thing I did was turn it all in to @property and dunder getattr / init magic, (they were doing bare init class with post attribute setters), oh, and they had one class per module...so they came in Monday freaking out "85% of the code base is gone!" I raised my hand and said "you're welcome". It was pretty rocky after that ;-)
@cfwebdeveloper
@cfwebdeveloper 4 күн бұрын
@@DrDeuteron jesus lol
@garfield-pro
@garfield-pro Ай бұрын
9:31 What would happen if we try to assign some value to c.diameter?
@KamilSawon
@KamilSawon 5 күн бұрын
Error - no setter defined.
@DrDeuteron
@DrDeuteron 4 күн бұрын
and if you do have the bad habit of assigning attributes outside of dunder init, you can use the setter to flag when it happens, so you can find the inevitable bug caused by that bad habit.
@balloney2175
@balloney2175 Ай бұрын
Tim is da python expert. I'm afraid of pythons.
@Dd-do-and-dont
@Dd-do-and-dont 19 күн бұрын
0:17 function, method or class
@iuritorres
@iuritorres 9 күн бұрын
someone can give me more examples of when dataclass will be more useful than normal classes?
@DrDeuteron
@DrDeuteron 4 күн бұрын
for me, when I'm reading 545 data fields of space craft telemetry, which is a helluva dunder init. Instead I just cut and paste the attributes from an excel file into a data class and it calls for a single mouse click. Moreover, dataclass comes with "fields", which can be used to describe the fields, the LaTex formulas for them. expected ranges, alarm ranges, broke ranges, and there is an astuple functions, which can be stuck in dunder iter, possible zip with the fields, and in about 3 lines of executable code, you can flag out-of-range telemetry. Very little dynamic code, and lots of static could is much simpler and less bug prone.
@philtoa334
@philtoa334 Ай бұрын
@salarbahador1270
@salarbahador1270 Ай бұрын
Which programming language doesn't support access modifiers these days? Do you think a convention stops people from wrongly using the methods or properties? Besides Python also doesn't support Interfaces. I'm not sure what's all the fuss about. Even modern PHP is more standard than Python; which people advertise PHP is dead.
@monishbiswas1966
@monishbiswas1966 Ай бұрын
Of course you’d never write a recursive Fibonacci function like that - you’d get it to return the last two numbers so you only need one recursive call.
@DrDeuteron
@DrDeuteron 4 күн бұрын
too clever.
@Smallz2000i
@Smallz2000i Ай бұрын
slowprint lol
@Al_Miqdad_
@Al_Miqdad_ Ай бұрын
can you give me your course for free and I'll pay after I get job please ? I don't have a job
@hasithkashyapa7645
@hasithkashyapa7645 Ай бұрын
Ok i saw the same thing few days ago. So this is basically a copy.
@TechWithTim
@TechWithTim Ай бұрын
Where did u see it?
@z.8477
@z.8477 Ай бұрын
PLEASE DO NOT Use These ANKWARD FACES
@publicuser775
@publicuser775 Ай бұрын
Hate this click bites
@davidmurphy563
@davidmurphy563 Ай бұрын
Just googled !r, it returns the repr in an f-string! And !s will give you dunder str. I had no idea this was a thing! Learned something new today.
10 Python Comprehensions You SHOULD Be Using
21:35
Tech With Tim
Рет қаралды 83 М.
Python Data Classes Are AMAZING! Here's Why
16:11
Tech With Tim
Рет қаралды 62 М.
КАРМАНЧИК 2 СЕЗОН 4 СЕРИЯ
24:05
Inter Production
Рет қаралды 524 М.
M3GAN’s ARMY got my finger! 😱🦾 #shorts
00:10
Adam B
Рет қаралды 19 МЛН
5 Useful Python Decorators (ft. Carberra)
14:34
Indently
Рет қаралды 75 М.
Python Object Oriented Programming (OOP) - For Beginners
53:06
Tech With Tim
Рет қаралды 3,2 МЛН
Python's __repr__ and __str__
3:28
Python Morsels
Рет қаралды 6 М.
15 Python Libraries You Should Know About
14:54
ArjanCodes
Рет қаралды 345 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1 МЛН
5 Good Python Habits
17:35
Indently
Рет қаралды 266 М.
Python 101: Learn These 5 Must-Know HIDDEN Features
16:38
Tech With Tim
Рет қаралды 65 М.
Python dataclasses will save you HOURS, also featuring attrs
8:50
All 39 Python Keywords Explained
34:08
Indently
Рет қаралды 44 М.
ADVANCED Python AI Agent Tutorial - Using RAG
40:59
Tech With Tim
Рет қаралды 101 М.
КАРМАНЧИК 2 СЕЗОН 4 СЕРИЯ
24:05
Inter Production
Рет қаралды 524 М.