Advance Python-Decorators Indepth Implementation

  Рет қаралды 35,806

Krish Naik

Krish Naik

Күн бұрын

github: github.com/krishnaik06/Machin...
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for a few months and I love it! www.kite.com/get-kite/?...
All Playlist In My channel
Interview Playlist: • Machine Learning Inter...
Complete DL Playlist: • Complete Road Map To P...
Julia Playlist: • Tutorial 1- Introducti...
Complete ML Playlist : • Complete Machine Learn...
Complete NLP Playlist: • Natural Language Proce...
Docker End To End Implementation: • Docker End to End Impl...
Live stream Playlist: • Pytorch
Machine Learning Pipelines: • Docker End to End Impl...
Pytorch Playlist: • Pytorch
Feature Engineering : • Feature Engineering
Live Projects : • Live Projects
Kaggle competition : • Kaggle Competitions
Mongodb with Python : • MongoDb with Python
MySQL With Python : • MYSQL Database With Py...
Deployment Architectures: • Deployment Architectur...
Amazon sagemaker : • Amazon SageMaker
Please donate if you want to support the channel through GPay UPID,
Gpay: krishnaik06@okicici
Telegram link: t.me/joinchat/N77M7xRvYUd403D...
Please join as a member in my channel to get additional benefits like materials in Data Science, live streaming for Members and many more
/ @krishnaik06
Please do subscribe my other channel too
/ @krishnaikhindi
Connect with me here:
Twitter: / krishnaik06
Facebook: / krishnaik06
instagram: / krishnaik06

Пікірлер: 52
@asehacha356
@asehacha356 Жыл бұрын
I have watch several u-tube videos on decorators & got more confused. You just made my day because I now clearly understand decorators. Excellent job!
@prakharakumar17
@prakharakumar17 2 жыл бұрын
Great work Sir, Your teaching method is very persuasive and I'm following 12 days of python for ML. Thank you !!
@bharatkori659
@bharatkori659 6 ай бұрын
These videos needs to go viral ,explained in such a beautifull way.
@hinata6657
@hinata6657 2 жыл бұрын
Amazing Video! Best explanation of decorators so far! Thank You
@mustakimsayyed5641
@mustakimsayyed5641 2 жыл бұрын
Finally after a month got this point cleared...Thnks Krish
@broswhoknowstuff
@broswhoknowstuff 3 жыл бұрын
Krish , excellent lessons! Than you for your hard work! I learned a lot here. It made me think. If I may so boldly add some additional logic to your great lecture on the copying of function's. I think Python's `concept of scope` is also an important topic to touch on when explaining function copying. Scope's are created only at function invocation( execution or call) and names are either "in scope" or "out-of-scope". I defined the welcome( ) function and using the following two assignment's: wel = welcome( ) and wel = welcome. The first assignment assigns a function call value. The later, only the function definition. NOTE: In either assignment's, the variable that is used reference's the exact same memory location of the defined function. ( I also use both the print and return statement's.) In the first assignment [ wel = welcome( ) ] , I use the print statement and the prints to standard output on the call to welcome( ). Now for function copying, and still using the print statement, I assign the variable 'wel' to 'welcome( )'. If I try to run "wel( )" I get `TypeError: 'NoneType' object is not callable `. "None" is also returned if you try to print the variable - 'wel' because there is no 'name' value given for any existing variable in the function's scope, only a print statement. If I instead use a 'return` statement instead, the returned 'value" is stored in the memory location of the welcome( ) function. The later method: `wel = welcome` (without parentheses ) copies the welcome ( ) function definition AND it's function body to "wel". Big Note here: the welcome( ) function is not executed at assignment! Now when you execute, wel( ), you get the string value. This is because the variable 'wel' is able to reference the body of the welcome( ) function in the global scope and invoke it , which 'wel( )' runs and creates it's local scope at the invocation for the value returned by the print statement. Am I close?
@9994392975
@9994392975 2 жыл бұрын
Wonderful. This is what am exactly looking for decorator and clouser. Thank you Krish.
@lalitharavichandran4015
@lalitharavichandran4015 Жыл бұрын
You explain so well. I understand well and I am learning out of interest. Keep going!
@rishabhkumar-qs3jb
@rishabhkumar-qs3jb 2 жыл бұрын
Amazing video, explanation is awesome, I was always confused about decorator. Got it now :)
@nurulkarim1416
@nurulkarim1416 Жыл бұрын
you made it easier to understand and it's great .
@gopinathrajamanickam9475
@gopinathrajamanickam9475 3 жыл бұрын
Great Job Krish, Closure is something I never used as a terminology and decorators were always a black box until now. I liked the logical building blocks in your teaching method. I think function copy you mentioned does not copy the function as such, the variable wel simply stores the result from the earlier execution of welcome() . Correct me if I am wrong.
@ghazalehsaffori1014
@ghazalehsaffori1014 3 жыл бұрын
Thank you 🙏🏻 it’s very helpful
@susmitvengurlekar
@susmitvengurlekar 3 жыл бұрын
Checking out the cell no helps in debugging bugs of non executions of cells (variable not found), using variables which have been initialised somewhere else, I don't need to advise this, but keep calm, don't get tense, you are doing a great work
@dikshagupta3276
@dikshagupta3276 Жыл бұрын
Mind blowing explanation clear all Doubts thanku 🙏
@g.jothilakshmikarthi6917
@g.jothilakshmikarthi6917 2 жыл бұрын
The way you explained is very good to understand easy bro excellent
@kandukurivaishnavi4492
@kandukurivaishnavi4492 Жыл бұрын
you are amazing krish
@abdullahshaikh7254
@abdullahshaikh7254 3 жыл бұрын
Wow amazing I like the way you are teaching Thank you sir
@vigneshkumarramesh4834
@vigneshkumarramesh4834 Жыл бұрын
thank you very much, excellent explanation!!!
@keshav9759
@keshav9759 Жыл бұрын
Sir i had a confusion at 6:19, i wanted to know when main_welcome() was called, which of the below described steps initiated: 1. when main_welcome() was called, then return sub_welcome_class() line initiated which then called the sub_welcome_class() function, which the printed the following lines. 2. Or any explanation which you would tell or say in modification of my explanation.
@lokeshpatel5018
@lokeshpatel5018 3 жыл бұрын
Thanks Krish, I just want to know what will be the type of 'wel' in function copy case. From my understanding it would be str() not function. as we've stored return value from function welcome and then stored to 'wel'. But if we remove the parentheses while calling that will assign the function object to 'wel'. Correct me If I'm missing anything here.
@sujitsahoo3081
@sujitsahoo3081 Жыл бұрын
exactly. Even i just got confused and later realized this.
@ShukyPersky
@ShukyPersky Жыл бұрын
Hi Krish. This is an appropriate opportunity to say thanks for your great videos and thank you for the good work you are making. I would like to comment regarding this video (time- 2:50) wel = welcome() - is NOT a function copy, it is a function invocation wel = welcome - creates a new reference to a function As you are an appreciated professional, may be I didn't follow your exact meaning. Can you please clarify? Thanks
@govindsingh2724
@govindsingh2724 3 жыл бұрын
Yesterday i was searching for closure , i got various videos but not satisfied. Finally , i get this one. Thank you sir🙏🏻
@AnimineStudios
@AnimineStudios 3 жыл бұрын
So you could say... That Kris Naik gave you closure?
@govindsingh2724
@govindsingh2724 3 жыл бұрын
You may say this , because he gave me exact explanation.
@sam_satish
@sam_satish 3 жыл бұрын
Sir, for a college student what is more important taking internships or working on various data sets and improvising the topics
@user-or7ji5hv8y
@user-or7ji5hv8y 3 жыл бұрын
Really good explanation
@ittecheval1868
@ittecheval1868 3 жыл бұрын
Closure mean, a function returned by another function and that returned function still have access to its sourrended variables where it is defined.
@austinmark242
@austinmark242 3 жыл бұрын
Powli muthee
@sarikavaidya6681
@sarikavaidya6681 2 жыл бұрын
superb well done
@ibadkhan481
@ibadkhan481 2 жыл бұрын
loved it
@divyanshidixit352
@divyanshidixit352 2 жыл бұрын
Great Content..😃
@kingpanthom
@kingpanthom 2 жыл бұрын
wel= welcome() actually copy the string to the variable wel and not the function. you did not call wel as function is called like wel(). The correct syntax to copy a function is wel = welcome without brackets.
@thegeekb0y
@thegeekb0y Жыл бұрын
I was thinking the same too!
@susmitvengurlekar
@susmitvengurlekar 3 жыл бұрын
You meant to code wel = welcome to demonstrating function copy right? Instead of wel = welcome() , which will just assign to wel whatever welcome() returns
@vrushabhjinde683
@vrushabhjinde683 2 жыл бұрын
Yess
@jagadeeshabburi570
@jagadeeshabburi570 2 жыл бұрын
For me non type object error appeared after creating decorator
@kajalverma6910
@kajalverma6910 2 жыл бұрын
According to me answer of your question: " after delete the function "welcome" is wel give the output or not" so my answer is no bcoz wel doesn't have any reference of that function so it doesn't give an output
@MrSmarthunky
@MrSmarthunky 3 жыл бұрын
Thank you. In one of the data science interviews, I was asked - where would you use decorators?
@faezakamran3793
@faezakamran3793 2 жыл бұрын
When we need a common functionality at several places. For instance, let's say there's a function square(), and there are let's suppose 5 other functions calling this square() function. In that case, you can make the square() function a decorator because it is being used in other 5 functions.
@info_man
@info_man Жыл бұрын
Now i understand where is @decorater the function just after it will pass as parameter
@kartiksharma-yw7qf
@kartiksharma-yw7qf 3 жыл бұрын
sir, any update about data science 15-month course by ineuron.
@krishnaik06
@krishnaik06 3 жыл бұрын
Check ineuron channel
@sauravmehare9034
@sauravmehare9034 3 жыл бұрын
Sir, I guess for the decorators we need to use " return sub_ welcome_class" instead of "return sub_welcome_class()"
@shaswatsood4595
@shaswatsood4595 3 жыл бұрын
if we "return sub_welcome_class" it will give the object address
@VivekKumar-up8hb
@VivekKumar-up8hb 3 жыл бұрын
during your session you missed one bracket and it did not threw any error, any specific reason?? ### Closures & initial Decorators def main_welcome(func): def sub_welcome_class(): print("Welcome To Krish Naik KZfaq Channel") print(func([1,2,3,4,5,6])) #bracket missed over here print("Please subscribe Krish channel") return sub_welcome_class()
@anandesh
@anandesh 2 ай бұрын
You forgot parameters passing in decorators
@CodeBeginnerTuts
@CodeBeginnerTuts 2 жыл бұрын
No Man, this is not advanced, this is the first step of decorators
@thedoruk724
@thedoruk724 3 жыл бұрын
Sir I am beginner suggest me how to start. I know basic python and data visualization.
@disneysful
@disneysful 2 жыл бұрын
Difficulty in understanding and u missed some points
@wellwhatdoyakno6251
@wellwhatdoyakno6251 2 жыл бұрын
it's going to get deleted.
@garyzhai9540
@garyzhai9540 2 жыл бұрын
I like your hard work, unfortunately from my personal point of perspective, it is rather confusing the way you elaborate the concept of Decorator in Python.
Python Series- is Vs == Indepth Explanation- Boolean Evaluation
6:57
Miracle Doctor Saves Blind Girl ❤️
00:59
Alan Chikin Chow
Рет қаралды 61 МЛН
How many pencils can hold me up?
00:40
A4
Рет қаралды 19 МЛН
$10,000 Every Day You Survive In The Wilderness
26:44
MrBeast
Рет қаралды 102 МЛН
КАРМАНЧИК 2 СЕЗОН 6 СЕРИЯ
21:57
Inter Production
Рет қаралды 506 М.
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 423 М.
Class Variables And Class Methods In Python
9:49
Krish Naik
Рет қаралды 30 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 92 М.
5 Useful Python Decorators (ft. Carberra)
14:34
Indently
Рет қаралды 84 М.
Shallow Copy Vs Deep Copy in Python
12:49
Krish Naik
Рет қаралды 69 М.
What are decorators in python
39:21
Chai aur Code
Рет қаралды 10 М.
Functools is one of the MOST USEFUL Python modules
13:37
Carberra
Рет қаралды 31 М.
Miracle Doctor Saves Blind Girl ❤️
00:59
Alan Chikin Chow
Рет қаралды 61 МЛН