#44 Python Tutorial for Beginners | Decorators

  Рет қаралды 601,579

Telusko

Telusko

Күн бұрын

Пікірлер: 456
@bharathg7284
@bharathg7284 5 жыл бұрын
I just realized that you being physically present in the video makes such a big difference to how much attention I pay. There are tons of videos out there but your videos work for me because there is someone teaching and I can see them typing the code. The expressions and gestures also help with the learning, maybe subconsciously we understand better if knowledge transfer is backed by facial expressions. Thanks again for choosing to share your knowledge, for free!
@wolverine87833
@wolverine87833 4 жыл бұрын
The same I felt
@Dre2k07
@Dre2k07 4 жыл бұрын
The best is when he makes mistakes and you can see his reaction lol makes it more real
@_.sunnyraj._
@_.sunnyraj._ 4 жыл бұрын
Me also for any video web cam is must
@iamniks
@iamniks 4 жыл бұрын
totally agree ..
@shivaramakrishnans4880
@shivaramakrishnans4880 4 жыл бұрын
Very very true...
@chrism3790
@chrism3790 5 жыл бұрын
You missed the most important part of the whole thing. Using the @ syntax before the function we want to wrap is what makes decorators useful.
@HomerSimpsonian
@HomerSimpsonian 5 жыл бұрын
I had to watch another video that explains it to make me see that the way he explained it was also very good. I was just thrown off by the lack of the @ syntax.
@bakachelera
@bakachelera 4 жыл бұрын
I was waiting for the @ thing, or a part 2 of this too. anyway this was a good video. Subscribed.
@gayalkuruppu9387
@gayalkuruppu9387 4 жыл бұрын
Same here 😒 went to another video. But this one is really good too!
@obviouscreed
@obviouscreed 4 жыл бұрын
Need the link for the other video, did not get this concept
@ritamchatterjee3307
@ritamchatterjee3307 4 жыл бұрын
what is this @ syntax all about, i dont know this can get any link please
@kamilkurzynowski3836
@kamilkurzynowski3836 3 жыл бұрын
For those asking about the missing @, this guy actually explains what are decorators not how they are written. The syntax is unimportant if you don't know what is happening behind the scenes. The issue I observe with new programmers is that people are using stuff that they have no idea how is it working. I appreciate a great conceptual explanation.
@purplemonkeydishwasher5269
@purplemonkeydishwasher5269 2 жыл бұрын
Yep. That would describe me. But Telusko threw in some really good information here. So basically the decorator is redefining where the 'div' object is pointing to in memory right?
@ranjeethstudio2483
@ranjeethstudio2483 Ай бұрын
But I don't know how to use @syntax and why they use @wrap. It will be helpful if he do separate video on this
@liquidred257
@liquidred257 14 күн бұрын
So I think I agree with what @ranjeethstudio2483 is getting at, insofar as while yes, "The syntax is unimportant if you don't know what is happening behind the scenes." 1. because the video is trying to teach what a wrapper is, at the same time that it's trying to explain what a decorator is, the video is harder to follow. 2. because this video is trying to teach what a decorator is, he should teach what a decorator is in a traditional setting. I.e. "here's what a decorator will look like when you see it in code and how it works." 3. It's not unimportant if you actually want to use them in your code.
@kandasamymurugadas6838
@kandasamymurugadas6838 4 жыл бұрын
You are the hero of students who are eager to learn coding but can't afford to go for tution ,even me.hands off to my guru
@GiovaniGalicia
@GiovaniGalicia 5 жыл бұрын
Ok, have to admit that this was one of the videos that was a little harder to grasp. I do get the main goal of decorators, but I am searching for more examples on how to use decorators. Your video was a great first start. Thank you!
@akashsuna5160
@akashsuna5160 2 жыл бұрын
Try code with harry for this one than jump to telusko you will get the Idea. No offence i am not comparing these two channels they both have their own taste our main intention is to grasp the concept
@SpaceTimeBeing_
@SpaceTimeBeing_ 2 жыл бұрын
@@akashsuna5160 don't promote that guy. India was humiliated 2 years ago during github's hacktoberfest because this moron misguided clueless people into participating in it. It was horrible thanks to him.
@liveinthemoment6218
@liveinthemoment6218 Жыл бұрын
I am a postgraduate in electronics field. I thought programming would be difficult, but u made it as simple as that. You are a great teacher. I have been working as a lecturer since 8 yrs . I have never seen a person like u, who teaches with so much of energy and enthusiasms. I have to learn many things from u -way of teaching.etc......
@asishraz6173
@asishraz6173 4 жыл бұрын
yes, agreed with many viewers that Navin sir haven't used '@' in the whole explanation. But we all understood the concept of Decorators through his explanation, which most of the KZbinrs failed to explain.
@extraxt
@extraxt 5 жыл бұрын
The best explanation I've seen so far. I'm a Python beginner (I work with Javascript).
@ThatGuyTheyareAfter
@ThatGuyTheyareAfter 4 жыл бұрын
Isn' this almost exactly like javascript's closures?
@kruthikahu904
@kruthikahu904 4 жыл бұрын
your teaching is just awesome sir! I have seen blockchain videos and now am learning python just by seeing your python videos. its just wow! great work sir. Thank You.
@divyasinha8204
@divyasinha8204 4 жыл бұрын
Sir why did we use ‘return inner’ in the end, I didn’t understand. Because ‘return func(a,b)’ is already doing the work of calling div(a,b) right? Then what is the use of return inner?
@uges_expo
@uges_expo 3 жыл бұрын
I just realized that you being physically present in the video makes such a big difference to how much attention I pay. There are tons of videos out there but your videos work for me because there is someone teaching and I can see them typing the code. The expressions and gestures also help with the learning, maybe subconsciously we understand better if knowledge transfer is backed by facial expressions. Thanks again for choosing to share your knowledge, for free!
@mdsadaquathussain307
@mdsadaquathussain307 5 жыл бұрын
Sir i saw the whole ad so that you get the reward😊😀
@_.sunnyraj._
@_.sunnyraj._ 4 жыл бұрын
🤣
@mohitbendale8229
@mohitbendale8229 4 жыл бұрын
just click the add and close it. It works on a cost per click. It won't do anything if you just watch the add.
@SaFFire123x
@SaFFire123x 4 жыл бұрын
@Dharmesh Rajan your mindset is what I call 'chutiya' mindset. Clearly, you were never taught to give back. Tutors like Navin Reddy are teaching for free and can't you even watch a 30s ad for him? Nobody is asking how to get rid of ads here. @mohit and @MD are talking about supporting the video creator by watching ads. Get lost with your tip that no-one asked for.
@SaFFire123x
@SaFFire123x 4 жыл бұрын
@Dharmesh Rajan Hey! Take it easy. I was only discouraging 'greedy mindset'. It's not just 5 minutes but 5000 hours of experience, pre and post processing that KZbinrs put into their videos. So the feeling of being morally obliged to give back should come from within. That's what I wanted to imply. No intention of hurting anyone. I felt like you were publicising the use of vanced on a completely irrelevant and unnecessary thread. Glad that you deleted it. Peace ✌️ and happy learning :)
@aerospacebriefcase2290
@aerospacebriefcase2290 3 жыл бұрын
@Stick / tutorials Thanks mate
@timtech9361
@timtech9361 2 жыл бұрын
Decorators are one of things added to the list of "Never Use Unless you Want to Ruin Your Program". Tread carefully.
@liquidred257
@liquidred257 14 күн бұрын
Since nobody wants to " 'Ruin [their] Program' " can you elaborate on when and when you should not use them, in your opinion? Prehaps give some resources?
@tarunseetha
@tarunseetha 5 жыл бұрын
Sir you are simply awesome. To be honest whenever I stuck for any technical topic, I immediately search on KZbin to check if there is any similar video posted by you. Your way of teaching is too good. Many thanks.
@gokulkrishnanselvaraj2384
@gokulkrishnanselvaraj2384 3 жыл бұрын
Sir when we defineing the function we must be call the function that's why the function it's works.but the inner function we don't calling how it's works?
@JasonGabler
@JasonGabler 2 жыл бұрын
Why is this better than a plain, straightforward call to the original function inside a new function without all the abstraction of decorating? This video is great at explaining the mechanics, but even one sentence as to why they are superior would be great.
@samthejam5202
@samthejam5202 4 жыл бұрын
Sir I think we should also add an "else" condition so that if we type the larger number first it will also return the answer. def div(a,b): print(a/b) def smart_div(func): def inner(c,d): if c
@asb8035
@asb8035 2 жыл бұрын
Now I understand WHY I would use a decorator ... simply illustrated and simply understood. We all learn differently and this was concise.
@ZyroZoro
@ZyroZoro 5 жыл бұрын
Thank you so much for this video! I've been trying for an hour to wrap my head around decorators (pun intended :P) and this is the first video that's made sense to me.
@hariomjoshi7131
@hariomjoshi7131 2 жыл бұрын
Really impressed! Actually I've been through 4-5 videos before, but no one cleared my doubts this easily, that also in just 7 minutes. ❣️ Really loved it.
@mayankjulah4408
@mayankjulah4408 4 жыл бұрын
Can we modify the in-built functions using decorators?
@SreekanthReddy22
@SreekanthReddy22 3 жыл бұрын
Sir, I have one doubt. Can't I do like the code mentioned below? def div(a,b): print (a/b) return a/b def inner(a,b, func): if a
@ayushsingh1726
@ayushsingh1726 4 жыл бұрын
Sir please make another video explaining this . Please sir .
@TheKapilsharma143
@TheKapilsharma143 3 жыл бұрын
Hey Navin, Thank you for sharing your amazing knowledge with you, This is the first video in 44 videos which I found a bit harder to grasp.
@feagy
@feagy 2 жыл бұрын
Exactly my thought 🤲
@MohammadIsmailAkheel
@MohammadIsmailAkheel 3 жыл бұрын
how does inner get called and when? what i have understood is we are passing the div function as parameter to the decorator function, which is returning inner_function. Now, the inner_function object or address will be overridden in the ‘div’ because we are capturing the returned function in it. After this, whenever we call div, the execution goes to inner_function in the decorator.
@anishdey3507
@anishdey3507 4 жыл бұрын
Hello Sir thank you very much for explaining the topic. I have one question regarding how the value is passed . When the object div1 was created and then in div1(2,4) value was passed , the object div1 was an instance of the function smart_div () which was taking a function as argument only, hence how the object of smart_div which is div1 pass the value 2,4 and got accepted. It will be helpful if you clear my doubt
@kavnainvohra8228
@kavnainvohra8228 3 жыл бұрын
I was confused in decorators, but this is the only video from which I really got my confusion cleared! Thanks man, Keep it up
@Pavankumar-xl4ov
@Pavankumar-xl4ov 3 жыл бұрын
Great teaching. But you missed @ syntax. and also can you explain it little deep about why we need to use inner functions etc. I am sure we can't explain decorator concept in just 7mins.
@aishwaryalaxmiveeramalla739
@aishwaryalaxmiveeramalla739 4 жыл бұрын
Using the @syntax... def smart_div(div): def inner(x,y): if x < y: x,y = y,x return div(x,y) return inner @smart_div def div(a,b): print(a/b) div(2,4)
@techy-anirban4067
@techy-anirban4067 4 жыл бұрын
Sir could u please make one separate video on decorator elaborately
@bsmaheshkumar5328
@bsmaheshkumar5328 4 жыл бұрын
Why do we have to write the logic inside the function of smart_div()? We could have done that right after smart_div function isn't it? Can anyone, please explain to me about this?
@edwardgregory9219
@edwardgregory9219 4 жыл бұрын
Can you guys help me understand something; If the below code also works (ignoring the ZeroDivision Error) why is there a need to add the additional inner function, as is in the tutorial? def div(a,b): print(a/b) def smartDiv(a,b): if a
@mpakash2041
@mpakash2041 2 жыл бұрын
Sir, may I know the reason for returning inner function?
@koushikchhetri8883
@koushikchhetri8883 4 жыл бұрын
This could be the possible decorator systex def smart_div(func): def inner(a, b): if(a
@iamdeepika2219
@iamdeepika2219 4 жыл бұрын
Hello sir, I would say your skills always astonish me .Basically I am from ECE background I am facing difficulties to understand these topics So I always used to feel low .but after watching your videos in no time I get motivated and inspired by the way you teach us.you are really doing great work.it means a lot for us.keep doing sir .thank you
@amansinghal349
@amansinghal349 3 жыл бұрын
Hello, I want to pursue ECE because i have interest in electronics field. Can you tell me that which coding language is most important for ECE students and if an ECE student wants a job in software company , then how can they join because they are not tought coding upto that much level which is required for software development.
@dipikapandya3163
@dipikapandya3163 3 жыл бұрын
Same here I am also from ECE background and this is the first language I am learning ... Thank you sir for teaching in such a way that the non it student also easily catch the concepts
@faiyaz7697
@faiyaz7697 4 жыл бұрын
Hi. If the inner(a,b) function is the one that is responsible to add/modify/influence the code of div(a,b) function, then what is the need to write the inner(a,b) function within smart_div(func) function ?
@nndhore
@nndhore 3 жыл бұрын
def div(a,b): return (a/b) print("step1") # step 1:'div' function will be called print(div(1,3)) print("step2") # step 2: 'div' function called and execution complete # (Step 1 & 2 has nothing to do with decorator_function) def decorator_function(func): print("step4") # step 4: 'decorator_function' execution starts. Note that 'inner_function' is still not called def inner_function(a,b): print("step7") # step 7: 'div1' function which is replica of 'inner_function' is being executed if a
@praveerroshan8376
@praveerroshan8376 3 жыл бұрын
@Telusko : I did not understand the use case of this decorator here , can't we just wrap div() in side another function which will just swap the values and pass to div() ? def div(x, y): print(x/y) def smart_div(x,y ): if x
@anilrautela5260
@anilrautela5260 2 жыл бұрын
Maybe new arguments of div method will also swap. but not sure
@Nnirvana
@Nnirvana 4 жыл бұрын
Before calling the function, what if I swap numbers (let's say prompted from user) checking inside if loop? Correct me if I am wrong.
@saicharan4669
@saicharan4669 4 жыл бұрын
Can we do the same thing without using the inner function there ,so that we just make use of smart_ div function directly
@IshitaKapur9
@IshitaKapur9 5 жыл бұрын
def div(a,b): print(a/b) def inner(a,b): if a
@yfjsdgzjdnfn
@yfjsdgzjdnfn 2 жыл бұрын
from math import sqrt def modify(func): def inn(a): return a*a return inn sq=modify(sqrt) print(sq(25)) print(sqrt(25)) My assignment sir 😁😁😁
@shreyashibasaiwal5893
@shreyashibasaiwal5893 4 жыл бұрын
Sir,your all videos are awesome indeed.But in this one, i am little bit stuck,i am not getting how smart div func is working,i mean when inner fun has been called and what is the purpose behind returning inner and all.Please,reply asap.SIR
@varungrow6036
@varungrow6036 4 жыл бұрын
Really helpful video for me and after a long time I have found a best teacher for guidance in programming .Thank u so much sir
@subomifatoyinbo4322
@subomifatoyinbo4322 3 жыл бұрын
I'll advise you do videos on concepts such as first-class functions and closures; these would help to understand the concept of decorators better. Well done.
@Aavikko12
@Aavikko12 5 жыл бұрын
Best decorator tutorial I have found from youtube. Thank you!
@stefkoum8111
@stefkoum8111 Жыл бұрын
You could also do your operation by using a HOF that just receives a function as one of its arguments. No need to return another function. An example: def division(a,b): return a/b def subtraction(a, b): return a - b def do_operation(operation, a, b): return operation(a, b) if a > b else operation(b, a) print(do_operation(division, 4, 12)) # 3.0 print(do_operation(division, 12, 4)) # 3.0 print(do_operation(subtraction, 4, 12)) # 8 print(do_operation(subtraction, 12, 4)) # 8
@sudheerpapasani541
@sudheerpapasani541 5 жыл бұрын
Bro I want to know about generators and Itreators so please have these two in your next video 🙏🙏
@nileshmishra8656
@nileshmishra8656 3 жыл бұрын
Beautifully explained !! I was looking everywhere for a relevant real scenario to test the use of decorators..
@sagarshrivastava4608
@sagarshrivastava4608 5 жыл бұрын
Sir learnt a lot of Python from your videos... But sir when you were discussing about OOPs concept.. You used the words Abstraction and Encapsulation which you never explained.. A request to you sir. Please make a video on that too..
@ankitgrover7618
@ankitgrover7618 4 жыл бұрын
abstraction stand for abstracting the data or hide the main code of function and show the neseccary detail to user like we are using ac remote,we press the on/off button but we don't know the concept of behind this pressing button this is called abstraction,or encapsulation stands for encapsulate the method/function or variable/variables in the class together is called encapsulation
@rangabharath4253
@rangabharath4253 5 жыл бұрын
def decorator(func): def new_div(a, b): if a < b: # 2/4 a, b = b, a # 4/2 return func(a, b) return new_div @decorator def div(a, b): print(a/b) div(2, 4) Nice video sir. Awesome as always. I tried using @ symbol above a function. Thank you for the awesome videos. Waiting for the new videos.
@pallasreenivasulu4624
@pallasreenivasulu4624 5 жыл бұрын
sorry broh...i am little confused at @
@rangabharath4253
@rangabharath4253 5 жыл бұрын
@@pallasreenivasulu4624hi, you have to use @ followed by the decorator function name which you are going to use to add the additional functionality. Then the normal function will get the functionalities of the decorator function. Hope you understand. @ is used to specify that it is a decorator function which is used to extend the functionality of a normal function, without adding the additional code. Thank you.
@pallasreenivasulu4624
@pallasreenivasulu4624 5 жыл бұрын
@@rangabharath4253 Thank you Ranga
@debjyotibanerjee7750
@debjyotibanerjee7750 3 жыл бұрын
This is the best example I found to understand decorator...😀
@learnerlifelong6455
@learnerlifelong6455 3 жыл бұрын
I am learning decorator for the first time. I wonder why do we need smart_div function? Can we simply not use inner function, which swaps a and be based on the condition, and finally use div = inner(div) Am I missing something?
@nehasah4693
@nehasah4693 2 жыл бұрын
Maybe, in that video, The function, inner(), accept argument a,b Whereas function, smart_div, accept a function 〈(•ˇ‿ˇ•)-→
@taufeequesifat8120
@taufeequesifat8120 3 жыл бұрын
2:04 - When a junior dev asks for help from a senior dev
@akashdeep7519
@akashdeep7519 4 жыл бұрын
what a explanation, great sir, none of other can explain like you. thank you for tutorials.
@vaibhavkrkm
@vaibhavkrkm 4 жыл бұрын
Nice explanation sir :) , by the way, I think we can add '@' also right for using decorators instead of assigning the old function to the new one🤔
@ganeshronge3449
@ganeshronge3449 Жыл бұрын
sir i really enjoyed learning python playlist, but sir, i'm totally form mechanical background and in some cases i can't understand the what is happening in the code and why it has been written and i have the dout in the decorators i.e. def div(a,b): print(a/b) def smart_div(func): def inner(a,b): if a
@asishraz6173
@asishraz6173 4 жыл бұрын
2:04, Our mom's reaction, when we don't do our housework in this corona time.
@ritikaagarwal7
@ritikaagarwal7 3 жыл бұрын
😂
@gopakumars1701
@gopakumars1701 3 жыл бұрын
could you please create a detailed video on decorators for clarrification?
@g2nd
@g2nd 4 жыл бұрын
I like this video but do python developers really lack the creativity to use different variable names? Most of the videos I watch use the same confusing variables like f, f1; tire, tires.
@u0314
@u0314 4 жыл бұрын
orrr you could just write this simple lambda expression: smartDiv = lambda a, b : a/b if a > b else b/a
@luckyjoshi6767
@luckyjoshi6767 4 жыл бұрын
Lambda can have only 1 expression I suppose dude
@ankitgrover7618
@ankitgrover7618 4 жыл бұрын
sir could you please make a new video on decorators i'm confused in this topic
@savithrisathyanarayanan7568
@savithrisathyanarayanan7568 4 жыл бұрын
Sir, my name is Krishnan.I am studying eleventh(11) standard . I have doubt whether this course is applicable for me. Kindly reply sir. Great teaching. I have doubt whether my school will teach like you and all the syllabus taught by you. I wanted to use the time judiciously during this corona time
@deltabypi
@deltabypi 4 жыл бұрын
yes !!!! this is helpful for all 11th and 12th grads to learn in advance
@banderilllero
@banderilllero 4 жыл бұрын
same thing w/o this stuff: def smart_div(a, b): if a < b: a, b = b, a return div(a, b)
4 жыл бұрын
you are new tesla
@santoshrajput23
@santoshrajput23 3 жыл бұрын
Those who are looking for the conventional @ syntax way of decorator coding, can use below for the same functionality. def decorator_function(orig_func): def wrapper_function(a,b): if a < b : a,b = b,a return orig_func(a,b) return wrapper_function @decorator_function def div(a,b): print(a/b) div(4,2) div(2,4)
@kanikvijay524
@kanikvijay524 4 жыл бұрын
sir can i create decorator without defining the inner function
@saswataacharya5431
@saswataacharya5431 4 жыл бұрын
even after debugging I didn't understand the concept completely.What is inner returning?
@jibinkmathai3370
@jibinkmathai3370 4 жыл бұрын
Same doubt...
@himanshudhiman5424
@himanshudhiman5424 4 жыл бұрын
Dude we first return inner, which in turn returns func(a,b) where a and b are swapped
@saeedanwar7559
@saeedanwar7559 4 жыл бұрын
@@himanshudhiman5424 can't we swap a and b directly under smart_div and return them, is creating def inner necessary??
@ranadeepreddy7009
@ranadeepreddy7009 8 ай бұрын
Why can't we write our code directly in smart_div? What is the need of inner function?
@malthaelaoc
@malthaelaoc 4 жыл бұрын
Mathematically speaking, decorators make sense. its essentially the concept of two functions, function f, and function g, in which the output of function f is the input of function g, which can be expressed as g(f(x)). The value of f(x) is first computed and then is used as an input for the g function, which further acts on that output, thus "decorating" it. The concept is really simple, one function taking the output of another function as its input. The confusion arises because of Python's mapping, and syntax, which quite honestly, takes a while to "register". So based on the example in this video, for instance, it supposed there is a function called div, which takes two arguments, a and b, and divides a by b, such as: a = int(input("Enter a value for a: ") b = int(input("Enter a value for b: ") def div(a, b): print(a/b) Then the function is called: div(a, b). If the user entered a value to "a", that is less than the value entered to "b", it will result in an output less than 1, and will violate the question. The way this problem can be solved, evidently, is through the use of decorators, which essentially declares a new function, such as div_new that takes the original div function as its input, and makes the necessary adjustments, such as reversing the value of a and b, or computing b/a, so that regardless of if the input value of a < b, the result will yield an integer value greater or equal to 1. Mathematically, the Python code would look like this: [code] def new_div(div(a, b)): def div(a, b): print(a/b) if a < b: print(b/a) new_div(div(a, b)) [/code] Basically, a new function new_div is created that takes the original first function div as its input. Once it goes inside the body of new_div, keeping in mind the values a, and b obtained by the client, it encounters the div function, which performs operations on a, b. Then it exits out of that function and falls into the body of new_div, encountering an if statement that tests the validity of a < b, and if it's True, then it instead prints out b/a, the reverse of a/b, which computes the quotient to a value greater than or equal to 1, without modifying the first function, thus solving the question correctly. This is the logic, though if you try to run that code the way it's written, python will throw all kinds of errors. lol. But for those trying to understand the logic, hope this helps.
@satyammhetre2832
@satyammhetre2832 4 жыл бұрын
Sir can u give some more examples where decorators can be used
@shubhajitchakraborty
@shubhajitchakraborty Жыл бұрын
This guy is a phenomenal teacher.
@PiyushKant-p6i
@PiyushKant-p6i 8 ай бұрын
I have been looking for decorators and explanation. It is possible that I might not be looking at the right place or with right keywords but not a single video explained it so u effortlessly as you did. Kudos.
@viswanath514
@viswanath514 4 жыл бұрын
This is the best and simple explanation of Decorators I ever seen, good job :)
@friendlychannel100
@friendlychannel100 4 жыл бұрын
# add functionality to div() without altering div() def smart_div(function): def inner(x, y): if x < y: x, y = y, x if y == 0: print("y cant be zero") return function(x, y) # calling div with new values # return function(x, y) return inner @smart_div # dec def div(a, b): print(a/b) # use '@' or 'div = smart_div(div) ' div(2, 4)
@mikekibet1786
@mikekibet1786 5 жыл бұрын
Well explained, thank you
@Alphabetbubi
@Alphabetbubi 5 жыл бұрын
At 6:25 how does the inner function get the parameters of div? How are a and b given into this construct??
@hussainnoor8957
@hussainnoor8957 4 жыл бұрын
so confusing
@meetangad
@meetangad 4 жыл бұрын
Sir - Can you advise what is the purpose of return used within smart div and inner?
@Ronitkable
@Ronitkable 2 жыл бұрын
For people saying missing @ in the tutorial, please find the equivalent usage done by the tutor. You could either go with div=smart_div(div) or use @ like @smart_div on top of function div. Both are same
@shashanktripathi3034
@shashanktripathi3034 4 жыл бұрын
what is the exact role of the "return inner" statement
@rishitak7419
@rishitak7419 4 жыл бұрын
Did you find its answer??
@Dp_writes
@Dp_writes 4 жыл бұрын
Why are we writing function Inside a function? cant we directly Write code only the in smart_div? Thank you for wonderful videos
@sr-ju4lq
@sr-ju4lq 2 жыл бұрын
Your presence makes the video so much better✨️
@mr.mk7323
@mr.mk7323 Жыл бұрын
So what i got from that is that decarators are functions that help with changing other function without messing with them right?
@luffys_poop
@luffys_poop Жыл бұрын
You can also decorator like this def smart_div(fun): def inner(a,b): if a
@sameerroshan9542
@sameerroshan9542 Ай бұрын
why are there two return statements in the decorator? which one is actually utilized?
@zakiasmaa6834
@zakiasmaa6834 Ай бұрын
The best explanation I've seen so far. Thanks a lot Sir
@sreekalapm2588
@sreekalapm2588 4 жыл бұрын
smart alien !.. you taught me this in 7.32 mn where i was trying hard to learn this from other sources for the past few hours
@06_shubhambirhade81
@06_shubhambirhade81 3 жыл бұрын
Your videos are always helpful, sir can u make some more examples for decorators? so we can get more clear idea of decorators.
@sanjitpaul2953
@sanjitpaul2953 3 жыл бұрын
Thank you Sir, now I have understood it properly.
@rajsekharrouthu8438
@rajsekharrouthu8438 4 жыл бұрын
What a fantastic explanation bro
@shillpichaudhary
@shillpichaudhary 4 жыл бұрын
______________Use of @ in Decorators __________ We simply use @ symbol before the function we would like to decorate. Example : def smart_div(func): def inner_div(a,b): if a
@quant-prep2843
@quant-prep2843 3 жыл бұрын
telusko could you please use dark mode while teaching? isnt coders prefer dark mode because its strain to the eyes right?
@sachetambere7028
@sachetambere7028 4 жыл бұрын
hello sir, The changes which we are making in the existing function are permanent or temporary ???
@rakeshvarma1825
@rakeshvarma1825 2 жыл бұрын
def smart_div(func): def inner(a,b): if a
@hughp5646
@hughp5646 3 жыл бұрын
Really nice explanation. Well produced video. Thanks!
@mistermanoj3181
@mistermanoj3181 4 жыл бұрын
if put 4,2 instead of 2,4 it doesn't give any output after we have taken in the decorators.Adding else return func(a,b) in definition of inner solves it.
@swamygoskula1785
@swamygoskula1785 3 жыл бұрын
U are a exellent mentor really awesome explanation and very very interesting the way u explained
@rushikeshdhok8249
@rushikeshdhok8249 4 жыл бұрын
Sir, I have a doubt. why we return the inner I don't understand what it does and why we do that. Please do reply sir. Thank you. I am VSITian
@jibinkmathai3370
@jibinkmathai3370 4 жыл бұрын
Same doubt here....
@adarshreddy9229
@adarshreddy9229 3 жыл бұрын
If u don't understand, try watching it again. It just worked for me, Try watchin' it again and again till u get it.
@letstry2854
@letstry2854 4 жыл бұрын
Wao.. excellent explanation sir.... finally my confusion is clear!!
@navaneethjnair6903
@navaneethjnair6903 2 жыл бұрын
Sir, Thank U for making decorators so easy. I have watched many videos but did not understood anything. Thanku and a great respect from Kerala 😊😊
#45 Python Tutorial for Beginners | Modules
7:20
Telusko
Рет қаралды 622 М.
#43 Python Tutorial for Beginners | Filter Map Reduce
11:34
Telusko
Рет қаралды 582 М.
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 202 МЛН
МЕБЕЛЬ ВЫДАСТ СОТРУДНИКАМ ПОЛИЦИИ ТАБЕЛЬНУЮ МЕБЕЛЬ
00:20
Learn Python DECORATORS in 7 minutes! 🎊
7:22
Bro Code
Рет қаралды 10 М.
Decorators in Python 🐍 with Example
6:34
Gate Smashers
Рет қаралды 23 М.
Python Tutorials - Decorators Part 1 | Introduction | Functions | Example
22:55
#49 Python Tutorial for Beginners | Class and Object
11:01
Telusko
Рет қаралды 828 М.
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 442 М.
Advance Python-Decorators Indepth Implementation
17:02
Krish Naik
Рет қаралды 37 М.
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 855 М.