Decorators In Python | Python Tutorials For Absolute Beginners In Hindi #51

  Рет қаралды 244,311

CodeWithHarry

CodeWithHarry

Күн бұрын

Пікірлер
@arshverma8367
@arshverma8367 3 жыл бұрын
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.
@shivammittal6066
@shivammittal6066 3 жыл бұрын
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
@anonymouscoder2238
@anonymouscoder2238 2 жыл бұрын
Thanks for defining it in a simple way
@syedahmed-zu9pm
@syedahmed-zu9pm 2 жыл бұрын
thanks bhai tere comment ne kaafi help ki ye concept samajne me
@Amritasthegreatindiantaste
@Amritasthegreatindiantaste 2 жыл бұрын
Thanks for additional perks :)
@Swarnimshow
@Swarnimshow 2 жыл бұрын
@@shivammittal6066 thanks bhai
@killxAyush
@killxAyush 4 жыл бұрын
High-class content absolutely free thanks harry bhai...
@ABHISHEKKUMAR-nm6yw
@ABHISHEKKUMAR-nm6yw 3 жыл бұрын
बहुत ही कम लोग हिंदी में प्रोग्रामिंग सिखाते हैं। लोग अपने मातृ भाषा बोलने से शर्माते हैं। प्रोग्रामिंग सिखाते समय उन्हें लगता है की वे बहुत महान बन जायेंगे अंग्रेजी बोलकर। ऐसी अंग्रेज़ियत को धिक्कार है। आप को बहुत बहुत धन्यवाद् हिंदी की गरिमा रखने के लिए। जय हिन्द
@ATS_editz
@ATS_editz 3 жыл бұрын
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
@minakshee4672
@minakshee4672 4 жыл бұрын
Boht achhese samjhaya Harry bhaiya. Kisi ki video dekhke nahi samjha decorators. apne 5 min me samjha diya. Many many thanks
@mohitsharma-re1bc
@mohitsharma-re1bc 3 жыл бұрын
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....
@dilhaishaayr6142
@dilhaishaayr6142 4 жыл бұрын
Sir aapne ne apne 1 video me hi sare douts clear kar diye Thanks sir.........
@college6531
@college6531 4 жыл бұрын
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.
@shivamsrivastava5827
@shivamsrivastava5827 4 жыл бұрын
@@college6531 arre bhai vo ek saath dono condition check karne ke liye sirf 'if statement' ka use kiya hai.
@Unhappee_Soul
@Unhappee_Soul 3 жыл бұрын
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
@shivangkant8237 Жыл бұрын
True..
@amrendrasingh7140
@amrendrasingh7140 4 жыл бұрын
Highly underrated channel. Will share this with my friends. 👍👍👍
@tigerzindahai2506
@tigerzindahai2506 4 жыл бұрын
Love the video.. Jahapar log paise dekar coding sikhate, waha yeh Harry Bhai free mein sikha rhe hai.. KEEP IT UP !!
@NimeshSharmanimeshns04
@NimeshSharmanimeshns04 5 жыл бұрын
Immediately pressed the like button when i heard how harry said "Let's roll the intro!"
@vmaindola
@vmaindola 4 ай бұрын
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")
@priyammalhotra5325
@priyammalhotra5325 3 жыл бұрын
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
@aryanbhosale9254
@aryanbhosale9254 3 жыл бұрын
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
@narora8459
@narora8459 3 жыл бұрын
Nobody teches at this level Vo bhi absolutely free...😊😊
@priyankamotiani1937
@priyankamotiani1937 4 жыл бұрын
"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)
@adityashukla1818
@adityashukla1818 3 жыл бұрын
These type of examples of basic functions(like finding a factorial) are really very helpful for the beginners. Thanks!
@Irfan-2500
@Irfan-2500 3 жыл бұрын
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?
@ajitesharyafirenib
@ajitesharyafirenib 3 жыл бұрын
Ab jakar samajh aya decorators thanks harry bhai...
@SwapnadeepMukherjee
@SwapnadeepMukherjee 3 жыл бұрын
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.
@dhyeypatel4710
@dhyeypatel4710 4 жыл бұрын
bro pehli bar koi programming ki video dekh k dil se avaj nikli , '' Bhai , Maja aa gaya !!!!!!!! ''
@cocomoco902
@cocomoco902 3 жыл бұрын
i watched this video 4 time..finally understand decorators..thanks alot!!!
@ashutoshchoubey369
@ashutoshchoubey369 5 жыл бұрын
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-nu5og
@WHITEDEVIL-nu5og 3 жыл бұрын
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
@ketanbutte3497
@ketanbutte3497 2 жыл бұрын
Excellent explanation Harry Bhai ! @ ka syntax sikhane se pahle apne jo explain kiya hai wo ekdum badhiya laga!!
@anishamalblanco7386
@anishamalblanco7386 4 жыл бұрын
Tum Legend Ho Bhai. ♥️
@payalbhatia6927
@payalbhatia6927 4 жыл бұрын
This is amazing, sir. First time I understand decorator... This had been horrible topic..not now
@programmerlovers8071
@programmerlovers8071 2 жыл бұрын
Nice sir I reach this exercise wed 30 March 2022. I started this playlist on dec 2021.Your explanation is too good.
@gurpratapsingh5730
@gurpratapsingh5730 Жыл бұрын
aa gaya samajh mereko, thanks harry 🙂
@amanthakur6913
@amanthakur6913 4 жыл бұрын
#Here is one example of decorators def divison(a,b): print(a/b) def update(func): def inner(a,b): if a
@SahilKumar-ni7su
@SahilKumar-ni7su 4 жыл бұрын
tulusko
@Irfan-2500
@Irfan-2500 3 жыл бұрын
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?
@foreveryour11
@foreveryour11 2 жыл бұрын
@@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.
@vivekmaurya9554
@vivekmaurya9554 5 жыл бұрын
Thank for these videos
@aarushiagarwal8938
@aarushiagarwal8938 2 жыл бұрын
Thanks for explaining it in a more simple way.🙂🙂
@mohammadsaif550
@mohammadsaif550 5 жыл бұрын
congrats for 50k subscribers harry bhai
@dheeraj5023
@dheeraj5023 4 жыл бұрын
Sir, You are best teacher for me 👍👍👍👍👍
@vedanshsoni959
@vedanshsoni959 7 ай бұрын
The content quality is too good that I am watching after 5 years
@webcreationstudio7088
@webcreationstudio7088 3 жыл бұрын
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()
@androdeveloper7261
@androdeveloper7261 3 жыл бұрын
2:57 : *When You are returning from Java / C to python* 😂 _I can feel , Harry bhai_ 😁
@webcreationstudio7088
@webcreationstudio7088 3 жыл бұрын
haa bhai
@robosapien1413
@robosapien1413 3 жыл бұрын
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....
@villagevibes6472
@villagevibes6472 5 жыл бұрын
Great video harry bhai
@rikuadak9812
@rikuadak9812 3 жыл бұрын
What happens if we have some positional arguments in the function we are decorating? How does it work then? Please explain.
@AbdulRehman-yg6xv
@AbdulRehman-yg6xv 4 жыл бұрын
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-2500
@Irfan-2500 3 жыл бұрын
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?
@smumarhashmi
@smumarhashmi 2 жыл бұрын
@@Irfan-2500 Looking for the answer of the same!
@raghavmanishraghavmanish8468
@raghavmanishraghavmanish8468 2 жыл бұрын
as a beginner ye wala topic smjh nhh aaaya tha bt thodi kosis krke aur dobara dekh ke aa gya smjh
@Amritasthegreatindiantaste
@Amritasthegreatindiantaste 2 жыл бұрын
Nice and short Thanks for explaining ..
@mayurthorat512
@mayurthorat512 4 жыл бұрын
Nyc explain harry bhai ✌️👍🙂
@sanjeevKumar-eg6hp
@sanjeevKumar-eg6hp 2 жыл бұрын
Nice explanation its was easy to understand
@mr_pavya
@mr_pavya 4 жыл бұрын
bahoot badiya sir jii.....
@sufiyanmogal1527
@sufiyanmogal1527 11 ай бұрын
bro your old videos are lit for understanding
@bhanusachdeva2136
@bhanusachdeva2136 3 жыл бұрын
Harry Bhai, jabardast
@aishwaryakalburgi6617
@aishwaryakalburgi6617 3 жыл бұрын
Wow you explained so well🤩🤩
@MdRizwanRabbani
@MdRizwanRabbani 3 жыл бұрын
Best Explanation till date.😍
@haniyamaqsood9238
@haniyamaqsood9238 4 жыл бұрын
Very well explained
@umeshverma8902
@umeshverma8902 2 жыл бұрын
one cannot find such nice and simple explanation of decorators. concept get fits inside brain. 👍👌
@shamsraza6554
@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_
@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..
@HatakeKakashi10
@HatakeKakashi10 3 жыл бұрын
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 ?
@abhisheksharmaap328
@abhisheksharmaap328 5 жыл бұрын
Ek baar mai hi concept clear. Thanks harry 😎
@jay-dv3yy
@jay-dv3yy 4 жыл бұрын
sahi baat h💯👍...........
@yashrawat747
@yashrawat747 3 жыл бұрын
bhai aren't you getting an error while running the last code
@hmindia777
@hmindia777 3 жыл бұрын
You are awesome bro just too good for programming
@raghavmanishraghavmanish8468
@raghavmanishraghavmanish8468 2 жыл бұрын
now enjoying the playlist
@gleanfact8318
@gleanfact8318 3 жыл бұрын
Most Subscribed Coding Channel in the world
@santoshupadhye7645
@santoshupadhye7645 3 жыл бұрын
Succint explanation!
@aqdasak
@aqdasak 4 жыл бұрын
Harry bhai you are awesome
@Abhishek-ji6qj
@Abhishek-ji6qj 3 жыл бұрын
This is amazing bro....Now All my concepts are cleared related to this topic
@mr.kapoor3803
@mr.kapoor3803 5 жыл бұрын
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.
@anmolsingh4969
@anmolsingh4969 4 жыл бұрын
Nowexe() calll kiya hai
@patnawala6096
@patnawala6096 4 жыл бұрын
Bro decorator wala part ko aur simplified way me samjha sakte ho?
@MukeshYadav-wb5uo
@MukeshYadav-wb5uo 3 жыл бұрын
Aare abhai watch'. Repeatedly you will understand
@ritusharma773
@ritusharma773 4 жыл бұрын
2:00 Yes, it will run because you already assigned function2 as function1 So it will not through any error.
@ammanagrawal762
@ammanagrawal762 3 жыл бұрын
This is the error I am getting for: # Decorators In Python def func1(): print("Hello") # func1() func2 = func1 del func1 print(func2)
@yashjagdale7098
@yashjagdale7098 2 жыл бұрын
@@ammanagrawal762 why u wrote print(func2) ....instead of it write func2()
@abhijeetrai7833
@abhijeetrai7833 4 жыл бұрын
Explained so nicely, harry Bhai.
@SamarthRawat
@SamarthRawat Жыл бұрын
Thanks harry bhai for the videos
@abdeali004
@abdeali004 4 жыл бұрын
Thanks man very good verbal speech.
@sanchittoppr1990
@sanchittoppr1990 4 жыл бұрын
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
@dollcyjain2452
@dollcyjain2452 2 жыл бұрын
2:02 It will print "Subscribe Now" because function1 is assigned to func2 before its deletion
@akash131990
@akash131990 3 жыл бұрын
Hello Harry, Thanks !! you make everything easy!!Nice work
@vimalkumarchaudhary1913
@vimalkumarchaudhary1913 4 жыл бұрын
Winner winner Codewithharry coding dinner
@somebody3014
@somebody3014 2 жыл бұрын
1:58 Yes it'll work coz the function has been copied before deletion
@ayogmohanty8561
@ayogmohanty8561 5 жыл бұрын
Bhai agar mein parameter na du... toh kya yeh @dec1 chalega?????? matlab ki dec1 mein kuch parameter/argument hoga hi nahi
@darshanbothra2673
@darshanbothra2673 4 жыл бұрын
Thanks Harry Sir :)
@auroshisray9140
@auroshisray9140 3 жыл бұрын
Thanks Harry bhai!!
@shubhamsood589
@shubhamsood589 6 жыл бұрын
Sir ,what about dark theme?
@CodeWithHarry
@CodeWithHarry 6 жыл бұрын
very soon. OOPs videos will be in dark theme!
@shubhamsood589
@shubhamsood589 6 жыл бұрын
Okay thanks
@parthyadav01
@parthyadav01 4 жыл бұрын
Good simplification thanks..
@muhammadusmanakram406
@muhammadusmanakram406 6 жыл бұрын
decorators ka kiya faida h ???
@CodeWithHarry
@CodeWithHarry 6 жыл бұрын
They modify the function!
@SahilKumar-ni7su
@SahilKumar-ni7su 4 жыл бұрын
@@CodeWithHarryhmm sir now i understood
@malikahmad1088
@malikahmad1088 11 ай бұрын
This creates a wrapper around the original function.
@devayushbajaj2813
@devayushbajaj2813 3 жыл бұрын
data structures like arays and linked list are not included in this playlist right?
@harshal3123
@harshal3123 2 жыл бұрын
It helps alot ....thnks
@siddiqui_hira
@siddiqui_hira 3 жыл бұрын
Your teaching is such a masterpiece, Ma Shaa ALLAH.
@harshit_gupta_haryana
@harshit_gupta_haryana 4 жыл бұрын
2:00 haa kyuki func1 Nam ka function already func2 nam ke dabbe me ja chuka tha :)
@buddhadebbairagi2022
@buddhadebbairagi2022 4 жыл бұрын
Yes bro, aab phir se dabba khola aur func2 se func1 ko nikal liya.🤗
@pryanshusharma6939
@pryanshusharma6939 3 жыл бұрын
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 :-(
@piyushgoyal4134
@piyushgoyal4134 2 жыл бұрын
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")
@jitenderkumarsingh3613
@jitenderkumarsingh3613 2 жыл бұрын
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.
@Unikconstruct
@Unikconstruct 2 жыл бұрын
1:55 it just assign new name to the function1 i.e func2, it does not create a new function
@dhrumilmistry3559
@dhrumilmistry3559 2 жыл бұрын
Best explanation ever for decorators!!! How can we pass and use args in decors?
@israr__ahmad
@israr__ahmad 4 жыл бұрын
bhai aapne jo nested function banaya hai uski jagah hum sirf ek function bana sakte hai ?????
@anantchandak9574
@anantchandak9574 3 жыл бұрын
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
@ishtiaqahmad4118
@ishtiaqahmad4118 4 жыл бұрын
You have explained fine. I.A.Siddiqui
@krishnanegi2295
@krishnanegi2295 3 ай бұрын
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.
@admmania4852
@admmania4852 3 жыл бұрын
Thanks brother for clearing such complicated thing seems like it nothing now just establishing relation between two functions .
@geniusguyisme
@geniusguyisme 3 жыл бұрын
Yes It will print Harry Bhai
@Rehulzretouch
@Rehulzretouch 3 жыл бұрын
1:59 aaega ye ans maine run krfiya poochne ke pehle hi 😂😁
@saswatibarman9478
@saswatibarman9478 4 жыл бұрын
Yes, output will come
@kaushalsahu7243
@kaushalsahu7243 4 жыл бұрын
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-jp8tn
@Kunal-jp8tn 3 жыл бұрын
thank you so much this helped me a lot.
@ChandrapalSd
@ChandrapalSd 4 жыл бұрын
3 baar dekha jab jake samaj me aaya😲
@SahilKumar-ni7su
@SahilKumar-ni7su 4 жыл бұрын
mai 3 saal se dekh rha hu avi smz me aaya :d
@iUmerFarooq
@iUmerFarooq 5 жыл бұрын
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_
@TariqAhmed_ 4 жыл бұрын
Right
@SahilKumar-ni7su
@SahilKumar-ni7su 4 жыл бұрын
right man
@sanchittoppr1990
@sanchittoppr1990 4 жыл бұрын
I understood in one video
@ankitakumarikumari4661
@ankitakumarikumari4661 4 жыл бұрын
WHAT WAS THE NEED OF DEF NOWEXEC() UNDER THE FUNCTION DEF DEC1(FUNC1),IT WOULD HAVE WORKED WITHOUT IT ALSO?
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
Top Skills to Learn in 2025
9:31
CodeWithHarry
Рет қаралды 283 М.
5 Mistakes Beginner Web Developers Make (Avoid These)
12:09
CodeWithHarry
Рет қаралды 120 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН