Python Decorators are one of the most helpful and powerful tools of Python. These are used to modify the behavior of the function. A decorator is nothing but a function that takes a function to be decorated as its parameter, and returns a function.
@shivammittal60663 жыл бұрын
I personally found it really difficult to understand at once. But after trying it a few time myself, it feels really helpful indeed. We are simply changing some functionality of a function without changing the function itself
@anonymouscoder22382 жыл бұрын
Thanks for defining it in a simple way
@syedahmed-zu9pm2 жыл бұрын
thanks bhai tere comment ne kaafi help ki ye concept samajne me
@Amritasthegreatindiantaste2 жыл бұрын
Thanks for additional perks :)
@Swarnimshow2 жыл бұрын
@@shivammittal6066 thanks bhai
@killxAyush4 жыл бұрын
High-class content absolutely free thanks harry bhai...
@ABHISHEKKUMAR-nm6yw3 жыл бұрын
बहुत ही कम लोग हिंदी में प्रोग्रामिंग सिखाते हैं। लोग अपने मातृ भाषा बोलने से शर्माते हैं। प्रोग्रामिंग सिखाते समय उन्हें लगता है की वे बहुत महान बन जायेंगे अंग्रेजी बोलकर। ऐसी अंग्रेज़ियत को धिक्कार है। आप को बहुत बहुत धन्यवाद् हिंदी की गरिमा रखने के लिए। जय हिन्द
@ATS_editz3 жыл бұрын
1:55 yes sir it will because we have assigned the value of function1 to func2 .So if we delete function1 it will not throw an error as the value is being assigned to func2
@minakshee46724 жыл бұрын
Boht achhese samjhaya Harry bhaiya. Kisi ki video dekhke nahi samjha decorators. apne 5 min me samjha diya. Many many thanks
@mohitsharma-re1bc3 жыл бұрын
No words....Everytime i need to know about any concept, i found my guide Harry sir.... No need to go anywhere.... Complete solution.... Great work Harry Bhaiya....
@dilhaishaayr61424 жыл бұрын
Sir aapne ne apne 1 video me hi sare douts clear kar diye Thanks sir.........
@college65314 жыл бұрын
Bhai 3:00 me harry bhai ne do baar "if" Use kiya aur elif else ka istemaal nahi kiya . Aisa kyun hai zara batao ge.
@shivamsrivastava58274 жыл бұрын
@@college6531 arre bhai vo ek saath dono condition check karne ke liye sirf 'if statement' ka use kiya hai.
@Unhappee_Soul3 жыл бұрын
I wish I could have seen ur videos earlier... I m really grateful that I got ur channel and now I am understanding every concept of programming..... keep creating this kind of content to help us..
@shivangkant8237 Жыл бұрын
True..
@amrendrasingh71404 жыл бұрын
Highly underrated channel. Will share this with my friends. 👍👍👍
@tigerzindahai25064 жыл бұрын
Love the video.. Jahapar log paise dekar coding sikhate, waha yeh Harry Bhai free mein sikha rhe hai.. KEEP IT UP !!
@NimeshSharmanimeshns045 жыл бұрын
Immediately pressed the like button when i heard how harry said "Let's roll the intro!"
@vmaindola4 ай бұрын
Hi Harry, We can use the same decorator more simply... def dec1(prm): print("Program starting") prm() print("Executed") @dec1 def func5(): print("My name is Terminator")
@priyammalhotra53253 жыл бұрын
harry bhai bhut dikkt hoti thi python smjhne me online classes me teachers use to skip some important topics but jabse aapki videos dekhna shuru kri h i am pretty sure will crack my placement easily.A big thanku for making this course
@aryanbhosale92543 жыл бұрын
Aaj me ye video revision ke liye 2saal baad dekhrha hu,purane din yaad agae wo feel firse agai jo kush aur serious learning me jati hai
@narora84593 жыл бұрын
Nobody teches at this level Vo bhi absolutely free...😊😊
@priyankamotiani19374 жыл бұрын
"I wrote a simple factorial program using decorators" def newfac(func): def inner(a): print("Now we are going to find the factorial of",a) if(a==0 or a==1): print("1") elif(a>1): return func(a) else: print("Enter correct no may be your no is negative ") return inner @newfac def factorial(a): s=1 for i in range(1,a+1): s=s*i print("Factorial of",a,"is= ",s) print("Enter the no to find is factorial") b=int(input()) factorial(b)
@adityashukla18183 жыл бұрын
These type of examples of basic functions(like finding a factorial) are really very helpful for the beginners. Thanks!
@Irfan-25003 жыл бұрын
Hello Priyanka. I still do not understand the purpose of using 2 functions(one outer and one nested) in the decorator. Can't we just use one function?
@ajitesharyafirenib3 жыл бұрын
Ab jakar samajh aya decorators thanks harry bhai...
@SwapnadeepMukherjee3 жыл бұрын
You make really nice and easily understandable videos. While I take 2-3 iterations to understand the simplest of concepts from other popular channels, yours takes me 1 or max 2 iterations to understand. Thanks for the help.
@dhyeypatel47104 жыл бұрын
bro pehli bar koi programming ki video dekh k dil se avaj nikli , '' Bhai , Maja aa gaya !!!!!!!! ''
@cocomoco9023 жыл бұрын
i watched this video 4 time..finally understand decorators..thanks alot!!!
@ashutoshchoubey3695 жыл бұрын
Harry bro iss pure video me jab aapne kaha tha ki kisi server se connect kar sakte hain . Usi se pura video clear ho gya decorators ka.
@WHITEDEVIL-nu5og3 жыл бұрын
01:45 yes karega print because function1 ki value func2 main store ho gayi h ab aap usse delete bhi kar do to bhi value print hogi
@ketanbutte34972 жыл бұрын
Excellent explanation Harry Bhai ! @ ka syntax sikhane se pahle apne jo explain kiya hai wo ekdum badhiya laga!!
@anishamalblanco73864 жыл бұрын
Tum Legend Ho Bhai. ♥️
@payalbhatia69274 жыл бұрын
This is amazing, sir. First time I understand decorator... This had been horrible topic..not now
@programmerlovers80712 жыл бұрын
Nice sir I reach this exercise wed 30 March 2022. I started this playlist on dec 2021.Your explanation is too good.
@gurpratapsingh5730 Жыл бұрын
aa gaya samajh mereko, thanks harry 🙂
@amanthakur69134 жыл бұрын
#Here is one example of decorators def divison(a,b): print(a/b) def update(func): def inner(a,b): if a
@SahilKumar-ni7su4 жыл бұрын
tulusko
@Irfan-25003 жыл бұрын
Hello Aman. I still do not understand the purpose of using 2 functions(one outer and one nested) in the decorator. Can't we just use one function?
@foreveryour112 жыл бұрын
@@Irfan-2500 i had the same doubt. But for now understand that the default way to modify/ decorate an original function is to use two functions/ nested functions. Because the first takes the original function as an argument only (it kind of acts as an original function while decorating) while the second function is adding/modifying the first which is like the original function. And thus it returns a decorated/modified version of the original function.
@vivekmaurya95545 жыл бұрын
Thank for these videos
@aarushiagarwal89382 жыл бұрын
Thanks for explaining it in a more simple way.🙂🙂
@mohammadsaif5505 жыл бұрын
congrats for 50k subscribers harry bhai
@dheeraj50234 жыл бұрын
Sir, You are best teacher for me 👍👍👍👍👍
@vedanshsoni9597 ай бұрын
The content quality is too good that I am watching after 5 years
@webcreationstudio70883 жыл бұрын
def dec(function): def nowexce(): a=int(input("enter a number")); b=int(input("enter a second numeber")); c=function(a,b); print("the sum is:",c); return nowexce; def function(a,b): return a+b; function=dec(function); function()
@androdeveloper72613 жыл бұрын
2:57 : *When You are returning from Java / C to python* 😂 _I can feel , Harry bhai_ 😁
@webcreationstudio70883 жыл бұрын
haa bhai
@robosapien14133 жыл бұрын
harry bro before i was searched alot about tutorial for python in hindi ,,,,, i found some turorials but i was not confortable with them but after watching your lectures I stuck to this channel .... I think best tutorial for indians on whole youtube....
@villagevibes64725 жыл бұрын
Great video harry bhai
@rikuadak98123 жыл бұрын
What happens if we have some positional arguments in the function we are decorating? How does it work then? Please explain.
@AbdulRehman-yg6xv4 жыл бұрын
Simple decorator practice program import random def decorater_practice(function): def executor(): lis = [1,2,3,4,5,6,7,8,9,10] a = random.choice(lis) b = function(a) print(f"Random number selected by computer {a} and output generated after function call {b}") return executor() def guess(num): print(f"Guess Number Between {num-3}-{num+3}") n = int(input("Enter Number")) if num == n: return "You Guess Properly you won:" else: return "You won't guess the number you lose" decorater_practice(guess) @decorater_practice def square(num): return num*num
@Irfan-25003 жыл бұрын
Hello Abdul Rehman. I still do not understand the purpose of using 2 functions(one outer and one nested) in the decorator. Can't we just use one function?
@smumarhashmi2 жыл бұрын
@@Irfan-2500 Looking for the answer of the same!
@raghavmanishraghavmanish84682 жыл бұрын
as a beginner ye wala topic smjh nhh aaaya tha bt thodi kosis krke aur dobara dekh ke aa gya smjh
@Amritasthegreatindiantaste2 жыл бұрын
Nice and short Thanks for explaining ..
@mayurthorat5124 жыл бұрын
Nyc explain harry bhai ✌️👍🙂
@sanjeevKumar-eg6hp2 жыл бұрын
Nice explanation its was easy to understand
@mr_pavya4 жыл бұрын
bahoot badiya sir jii.....
@sufiyanmogal152711 ай бұрын
bro your old videos are lit for understanding
@bhanusachdeva21363 жыл бұрын
Harry Bhai, jabardast
@aishwaryakalburgi66173 жыл бұрын
Wow you explained so well🤩🤩
@MdRizwanRabbani3 жыл бұрын
Best Explanation till date.😍
@haniyamaqsood92384 жыл бұрын
Very well explained
@umeshverma89022 жыл бұрын
one cannot find such nice and simple explanation of decorators. concept get fits inside brain. 👍👌
@shamsraza6554 Жыл бұрын
#just simplified version . Please start analyzing from last line HARRY() def exe(HARRY): #redirects to line 2 def nowexe(): #redirects to line 3 print("First, it is called") #redirects to line 4 HARRY() #redirects to line 8 to execute SHAMS() print("Finally, it is called") return nowexe @exe #redirects to line 1 def HARRY(): #redirects to line 9 print("Then, it is called") #Redirected to line 5 HARRY() #redirects to line 7 just before "def HARRY()"
@TariqAhmed_4 жыл бұрын
Harry bhai aap ne dictionary wali video main copy ka function use kiya aur kaha tha jab hum equal ka istamal kraingy toh copy nh hogi yahan equal ka use kiya toh copy kese ban gai plz must reply..
@HatakeKakashi103 жыл бұрын
sir aapka laptop always charge me hi laga hota he kya ?? mene suru se dekh rahi hu ye playlist even python tut with notes wala bhi dekha he and c lang.+ notes wala video dekha tha but sir jesa mera sawal apka laptop humesha icu me charge kyu ?
@abhisheksharmaap3285 жыл бұрын
Ek baar mai hi concept clear. Thanks harry 😎
@jay-dv3yy4 жыл бұрын
sahi baat h💯👍...........
@yashrawat7473 жыл бұрын
bhai aren't you getting an error while running the last code
@hmindia7773 жыл бұрын
You are awesome bro just too good for programming
@raghavmanishraghavmanish84682 жыл бұрын
now enjoying the playlist
@gleanfact83183 жыл бұрын
Most Subscribed Coding Channel in the world
@santoshupadhye76453 жыл бұрын
Succint explanation!
@aqdasak4 жыл бұрын
Harry bhai you are awesome
@Abhishek-ji6qj3 жыл бұрын
This is amazing bro....Now All my concepts are cleared related to this topic
@mr.kapoor38035 жыл бұрын
Hello Harry bhai why wre we returning nowexec function by itslef. Removing the last line of nowexec function will also give the same result. Please answer.
@anmolsingh49694 жыл бұрын
Nowexe() calll kiya hai
@patnawala60964 жыл бұрын
Bro decorator wala part ko aur simplified way me samjha sakte ho?
@MukeshYadav-wb5uo3 жыл бұрын
Aare abhai watch'. Repeatedly you will understand
@ritusharma7734 жыл бұрын
2:00 Yes, it will run because you already assigned function2 as function1 So it will not through any error.
@ammanagrawal7623 жыл бұрын
This is the error I am getting for: # Decorators In Python def func1(): print("Hello") # func1() func2 = func1 del func1 print(func2)
@yashjagdale70982 жыл бұрын
@@ammanagrawal762 why u wrote print(func2) ....instead of it write func2()
@abhijeetrai78334 жыл бұрын
Explained so nicely, harry Bhai.
@SamarthRawat Жыл бұрын
Thanks harry bhai for the videos
@abdeali0044 жыл бұрын
Thanks man very good verbal speech.
@sanchittoppr19904 жыл бұрын
Yes because the func2 is duplicated before the function1 is deleted so the content of the function1 is copied and the content of the func2 is remain if you delete
@dollcyjain24522 жыл бұрын
2:02 It will print "Subscribe Now" because function1 is assigned to func2 before its deletion
@akash1319903 жыл бұрын
Hello Harry, Thanks !! you make everything easy!!Nice work
@vimalkumarchaudhary19134 жыл бұрын
Winner winner Codewithharry coding dinner
@somebody30142 жыл бұрын
1:58 Yes it'll work coz the function has been copied before deletion
@ayogmohanty85615 жыл бұрын
Bhai agar mein parameter na du... toh kya yeh @dec1 chalega?????? matlab ki dec1 mein kuch parameter/argument hoga hi nahi
@darshanbothra26734 жыл бұрын
Thanks Harry Sir :)
@auroshisray91403 жыл бұрын
Thanks Harry bhai!!
@shubhamsood5896 жыл бұрын
Sir ,what about dark theme?
@CodeWithHarry6 жыл бұрын
very soon. OOPs videos will be in dark theme!
@shubhamsood5896 жыл бұрын
Okay thanks
@parthyadav014 жыл бұрын
Good simplification thanks..
@muhammadusmanakram4066 жыл бұрын
decorators ka kiya faida h ???
@CodeWithHarry6 жыл бұрын
They modify the function!
@SahilKumar-ni7su4 жыл бұрын
@@CodeWithHarryhmm sir now i understood
@malikahmad108811 ай бұрын
This creates a wrapper around the original function.
@devayushbajaj28133 жыл бұрын
data structures like arays and linked list are not included in this playlist right?
@harshal31232 жыл бұрын
It helps alot ....thnks
@siddiqui_hira3 жыл бұрын
Your teaching is such a masterpiece, Ma Shaa ALLAH.
@harshit_gupta_haryana4 жыл бұрын
2:00 haa kyuki func1 Nam ka function already func2 nam ke dabbe me ja chuka tha :)
@buddhadebbairagi20224 жыл бұрын
Yes bro, aab phir se dabba khola aur func2 se func1 ko nikal liya.🤗
@pryanshusharma69393 жыл бұрын
hello harry bhai ak question tha agar hum kisi function ko run krna chahta he decorator ka use krka or hama us function ka name nahe pta jsa ki django or flask use krta ha to vo ksa kraga ? please must reply ...... as soon as you can :-(
@piyushgoyal41342 жыл бұрын
How the func1 in line 26 will run if it is already changed to nowexec I think It will continue to loop. Please help To be more clear i think it will act like def Nowexec(): print("executing now") Nowexec() print("executed")
@jitenderkumarsingh36132 жыл бұрын
HI Harry, Where and how, you called inner function nowexec()? As we know, statement inside the function executed when we call the function. Without calling nowexec() function, why print("Executing now ") executed.
@Unikconstruct2 жыл бұрын
1:55 it just assign new name to the function1 i.e func2, it does not create a new function
@dhrumilmistry35592 жыл бұрын
Best explanation ever for decorators!!! How can we pass and use args in decors?
@israr__ahmad4 жыл бұрын
bhai aapne jo nested function banaya hai uski jagah hum sirf ek function bana sakte hai ?????
@anantchandak95743 жыл бұрын
2:05 bhai vo print karega kyoki hamne func2 ki value func1 phele de di thi to vo uske ander assing ho gaya phir ab usse func1 se koi lena dena nahi par agar ham del func1 phele kar dete to error deta
@ishtiaqahmad41184 жыл бұрын
You have explained fine. I.A.Siddiqui
@krishnanegi22953 ай бұрын
dostoo ye tutorial main 8:12 pe ye return nowexec nowexec() ke block ke bahar call ho rahi hai ye batao aisa possible hai kya ? wanted to know please help.
@admmania48523 жыл бұрын
Thanks brother for clearing such complicated thing seems like it nothing now just establishing relation between two functions .
@geniusguyisme3 жыл бұрын
Yes It will print Harry Bhai
@Rehulzretouch3 жыл бұрын
1:59 aaega ye ans maine run krfiya poochne ke pehle hi 😂😁
@saswatibarman94784 жыл бұрын
Yes, output will come
@kaushalsahu72434 жыл бұрын
bro before seeing yoursprogram i have seen many videos but no one had explain me like the way you have explaind. after seeing this videoi had immideatli subscribed you. thanks bro
@Kunal-jp8tn3 жыл бұрын
thank you so much this helped me a lot.
@ChandrapalSd4 жыл бұрын
3 baar dekha jab jake samaj me aaya😲
@SahilKumar-ni7su4 жыл бұрын
mai 3 saal se dekh rha hu avi smz me aaya :d
@iUmerFarooq5 жыл бұрын
Sir ap video ma code ka flow sahe sa nahe samja raha ha, q k ap ko ya batana chahiya k pehla code kidar ho ga os k bad kidar jae ga. Thank you
@TariqAhmed_4 жыл бұрын
Right
@SahilKumar-ni7su4 жыл бұрын
right man
@sanchittoppr19904 жыл бұрын
I understood in one video
@ankitakumarikumari46614 жыл бұрын
WHAT WAS THE NEED OF DEF NOWEXEC() UNDER THE FUNCTION DEF DEC1(FUNC1),IT WOULD HAVE WORKED WITHOUT IT ALSO?