These videos needs to go viral ,explained in such a beautifull way.
@asehacha3562 жыл бұрын
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!
@nisha71005 ай бұрын
Thanks a lot Krish, I watched 10 different videos on this concept and struggled to understand it. However, after finding your video, the explanation finally made sense and I was able to grasp the concept clearly.
@mustakimsayyed56413 жыл бұрын
Finally after a month got this point cleared...Thnks Krish
@govindsingh27244 жыл бұрын
Yesterday i was searching for closure , i got various videos but not satisfied. Finally , i get this one. Thank you sir🙏🏻
@M0N0T1C0L0URS4 жыл бұрын
So you could say... That Kris Naik gave you closure?
@govindsingh27244 жыл бұрын
You may say this , because he gave me exact explanation.
@prakharakumar173 жыл бұрын
Great work Sir, Your teaching method is very persuasive and I'm following 12 days of python for ML. Thank you !!
@guyswhoknowstuff3 жыл бұрын
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?
@ShukyPersky2 жыл бұрын
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
@lalitharavichandran4015 Жыл бұрын
You explain so well. I understand well and I am learning out of interest. Keep going!
@hinata66573 жыл бұрын
Amazing Video! Best explanation of decorators so far! Thank You
@99943929753 жыл бұрын
Wonderful. This is what am exactly looking for decorator and clouser. Thank you Krish.
@susmitvengurlekar4 жыл бұрын
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
@g.jothilakshmikarthi69172 жыл бұрын
The way you explained is very good to understand easy bro excellent
@rishabhkumar-qs3jb3 жыл бұрын
Amazing video, explanation is awesome, I was always confused about decorator. Got it now :)
@dikshagupta32762 жыл бұрын
Mind blowing explanation clear all Doubts thanku 🙏
@kingpanthom3 жыл бұрын
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.
@thegeekb0y2 жыл бұрын
I was thinking the same too!
@susmitvengurlekar4 жыл бұрын
You meant to code wel = welcome to demonstrating function copy right? Instead of wel = welcome() , which will just assign to wel whatever welcome() returns
@vrushabhjinde6832 жыл бұрын
Yess
@nurulkarim14162 жыл бұрын
you made it easier to understand and it's great .
@ittecheval18683 жыл бұрын
Closure mean, a function returned by another function and that returned function still have access to its sourrended variables where it is defined.
@keshav97592 жыл бұрын
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.
@abdullahshaikh72544 жыл бұрын
Wow amazing I like the way you are teaching Thank you sir
@gopinathrajamanickam94754 жыл бұрын
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.
@kandukurivaishnavi44922 жыл бұрын
you are amazing krish
@ghazalehsaffori10144 жыл бұрын
Thank you 🙏🏻 it’s very helpful
@vigneshkumarramesh48342 жыл бұрын
thank you very much, excellent explanation!!!
@lokeshpatel50183 жыл бұрын
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.
@sujitsahoo30812 жыл бұрын
exactly. Even i just got confused and later realized this.
@SatyaPrakashBehera-v5qАй бұрын
I didn't get the function copy. You are basically saving the return value of welcome in wel, so even if you delete the function wel is going to have the value. Because after executing the function you are deleting it.
@user-or7ji5hv8y4 жыл бұрын
Really good explanation
@MrSmarthunky4 жыл бұрын
Thank you. In one of the data science interviews, I was asked - where would you use decorators?
@faezakamran37933 жыл бұрын
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.
@austinmark2424 жыл бұрын
Powli muthee
@kajalverma69102 жыл бұрын
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
@divyanshidixit3523 жыл бұрын
Great Content..😃
@kartiksharma-yw7qf4 жыл бұрын
sir, any update about data science 15-month course by ineuron.
@krishnaik064 жыл бұрын
Check ineuron channel
@anandesh9 ай бұрын
You forgot parameters passing in decorators
@sarikavaidya66812 жыл бұрын
superb well done
@sauravmehare90344 жыл бұрын
Sir, I guess for the decorators we need to use " return sub_ welcome_class" instead of "return sub_welcome_class()"
@shaswatsood45954 жыл бұрын
if we "return sub_welcome_class" it will give the object address
@info_man Жыл бұрын
Now i understand where is @decorater the function just after it will pass as parameter
@sam_satish4 жыл бұрын
Sir, for a college student what is more important taking internships or working on various data sets and improvising the topics
@jagadeeshabburi5703 жыл бұрын
For me non type object error appeared after creating decorator
@SatyaPrakashBehera-v5qАй бұрын
def welcome(func): def sub_class(): print("Hello World") func() return sub_class @welcome def closing(): print("Execution Ends") wel = closing del welcome del closing wel()
@ibadkhan4812 жыл бұрын
loved it
@thedoruk7244 жыл бұрын
Sir I am beginner suggest me how to start. I know basic python and data visualization.
@VivekKumar-up8hb4 жыл бұрын
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 KZbin Channel") print(func([1,2,3,4,5,6])) #bracket missed over here print("Please subscribe Krish channel") return sub_welcome_class()
@disneysful3 жыл бұрын
Difficulty in understanding and u missed some points
@garyzhai95403 жыл бұрын
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.