Python Tutorial: if __name__ == '__main__'

Поделиться
HTML-код
  • Опубликовано: 21 мар 2015
  • In this video, we will take a look at a common conditional statement in Python:
    if _name_ == '__main__':
    This conditional is used to check whether a python module is being run directly or being imported.
    ✅ Support My Channel Through Patreon:
    / coreyms
    ✅ Become a Channel Member:
    / @coreyms
    ✅ One-Time Contribution Through PayPal:
    goo.gl/649HFY
    ✅ Cryptocurrency Donations:
    Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
    Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
    Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
    ✅ Corey's Public Amazon Wishlist
    a.co/inIyro1
    ✅ Equipment I Use and Books I Recommend:
    www.amazon.com/shop/coreyschafer
    ▶️ You Can Find Me On:
    My Website - coreyms.com/
    My Second Channel - / coreymschafer
    Facebook - / coreymschafer
    Twitter - / coreymschafer
    Instagram - / coreymschafer
    #Python

Комментарии • 1,6 тыс.

  • @samiam.402
    @samiam.402 2 года назад +717

    Dude, it's incredible how simple this concept is when it's explained well. So many other resources had my head spinning about it, but just one 8 minute RUclips video later, and I'm like "oh yeah well obviously."

    • @shaheenelt
      @shaheenelt 2 года назад +1

      p
      Ppp

    • @michaelhagans965
      @michaelhagans965 2 года назад +3

      shoot yeah Sam I am.

    • @tanchwa3740
      @tanchwa3740 2 года назад +7

      same boat here I was like what the hell is a __main__ and why should I even care lol. But this makes so much sense. I especially understand someone else's stack exchange comment now about how this is really important for global variables.

    • @buddhahead8734
      @buddhahead8734 2 года назад +1

      I'm glad this is where I looked first. It looked intimidating at first, but he made it make sense.
      Seems like a really intuitive feature.

    • @ronakpatel9023
      @ronakpatel9023 2 года назад +2

      You spoke my mind man….

  • @tyroneslothdrop9155
    @tyroneslothdrop9155 9 лет назад +2586

    Subscribed:
    That was by far the best explanation I've found on RUclips regarding this topic. I hope you continue to make videos.

    • @AhmedBalfaqih
      @AhmedBalfaqih 8 лет назад +43

      I agree with you. I subscribed based on this video only.

    • @Kevin-iu4kj
      @Kevin-iu4kj 8 лет назад +7

      no. this shit makes no sense

    • @codestorywithMIK
      @codestorywithMIK 7 лет назад +5

      Tyrone Slothdrop I totally agree

    • @purpleice2343
      @purpleice2343 7 лет назад +19

      Kevin, of course it doesn't make sense when you're braindead xD

    • @adityarprasanna
      @adityarprasanna 6 лет назад +4

      Came to the comment section to say the same thing and I see I was beat to it.

  • @blmcmcn
    @blmcmcn 4 года назад +692

    Short answer: this set up gives you the option to run (or not run) a chunk of code when imported from another python file

    • @Dorumin
      @Dorumin 4 года назад +10

      I got that from the first 20 seconds, it's quite a simple concept for me and I thought up a lot of usecases. Pretty interesting, I don't think I'll watch the rest of the video

    • @pulpil10
      @pulpil10 3 года назад +154

      @@Dorumin you are so smart

    • @Dorumin
      @Dorumin 3 года назад +22

      @@pulpil10 Yeah, looking back on this comment it did seem pretty pompous lol, but it really was pretty familiar enough for me to grok like that
      An example being a chess program that either runs on the command line if you run it directly or offers an API if imported

    • @ChrisT-ib1zh
      @ChrisT-ib1zh 3 года назад +1

      @@pulpil10 and you are right

    • @isMeStranger
      @isMeStranger 3 года назад +33

      @@Dorumin he explained nothing in the first 20 secs. Does patting yourself on the back make you feel any better?

  • @kogcyc
    @kogcyc 4 года назад +878

    Hi, Corey. If you ever wonder if you're making a difference in the world, then let me assure you that you are. Your videos make learning and using Python possible for those who watch them.
    Beautiful work. Thank you very much.

    • @coreyms
      @coreyms  4 года назад +85

      Thanks!

    • @gonzalotoloza6700
      @gonzalotoloza6700 7 месяцев назад

      @@coreymsyeah you helped us so much, thank u

  • @brandonhunter3036
    @brandonhunter3036 4 года назад +6

    The absolute clear and concise explanation I've seen on this in 5 years off and on of playing and working with Python. Well done!

  • @humanOSx
    @humanOSx 5 лет назад +36

    man you are awesome, I started with the first video of Flask series and now I come here for understand the ifmain conditional.
    thanks for your youtube channel, it will be for very much help, I am a new subscriber, like in all your videos.
    Greetings from México.

  • @rukhan8900
    @rukhan8900 3 года назад +19

    I hope you know that even 6 years after posting your content is still helping beginners like me understand python better than anything else on the internet can! Thank you for your work, it's great! :)

  • @vavilon7109
    @vavilon7109 3 года назад +22

    I thought that geneticists are terrible at naming things but coders have their share of confusing nomenclature. Despite that, I got it because of this video! Thanks Corey!

  • @supermanish
    @supermanish 6 лет назад +8

    Haven't encountered an explanation as good as this. Thank you!
    The world needs teachers like you.

  • @nigelmtb
    @nigelmtb 5 лет назад +27

    What everyone else said: best explanation available. Thank you very much.

  • @abu5197
    @abu5197 3 года назад +2

    I've literally been searching for this for the past two years. So simple yet I haven't seen anyone explain it better!

  • @AliColak
    @AliColak Год назад +2

    THIS MAKES SO MUCH SENSE. I spent an hour and a half today rewatching the video i learned it from and trying to get a grasp on it. Makes a lotta sense when you explain and show it the way you do. It's sort of like a validation prompt to see which file is being run to avoid duplicates etc.

  • @garydunken7934
    @garydunken7934 7 лет назад +4

    I considered "if __name__ == '__main__'' as some magical conditional check that triggered the main function for me, until I watched this video today. It's clear now. Your explanation was so clear and simple it made so much sense. Thanks.

  • @JRavenell
    @JRavenell 6 лет назад +4

    This is the best explanation with EXAMPLES I've ever seen on this. This will help me tremendously. I salute you!

  • @pptx704
    @pptx704 4 года назад +1

    I have read a lot of articles on this specific topic, but none of them could make me understand this "if __name__==__main__" thing. Thanks for making it simple and understandable. By far the best one I've come through!

  • @potterdkk4371
    @potterdkk4371 4 года назад +10

    I stuck for DAYS on this, THANK YOU SO MUCH for explaining the topic really clearly.

  • @codestorywithMIK
    @codestorywithMIK 7 лет назад +17

    You are the only one whose lecture cleared my concept of __main__ in python.
    i subscribed to your channel as soon as I understood the concept. thanks. keep uploading.

  • @jayw.1139
    @jayw.1139 5 лет назад +5

    Sir, you will live 10,000 years!! Thank you for this informative video. Straight and to the point to which I could easily comprehend.

  • @ashishdeora8522
    @ashishdeora8522 3 года назад +125

    It's hard to believe that such a complicated concept can be explained like this. Cheers Cory, the great!

    • @notanenglishperson9865
      @notanenglishperson9865 2 года назад +27

      It's not that complicated, it's just terribly explained by others

  • @zsszeli
    @zsszeli Год назад +19

    Man, this is the first video where I actually get what this means. You are the GOAT, my friend.

  • @Skypriv
    @Skypriv 4 года назад +27

    You rock. I'm so lucky, I looked down out of confusion while watching a tutorial because this was used (but I had no clue what it was).. my eyes just happened to see this video suggested, noice

  • @alfredgarrett9589
    @alfredgarrett9589 6 лет назад +22

    I commend you on your teaching. I struggled with this concept for a long time, now it seems so simple.

  • @jenniferf.8387
    @jenniferf.8387 4 года назад +5

    New to Python, I'm a C# developer, this video was exactly what I needed... just had to find the right one so it would click. THANK YOU!

  • @BythanProductions
    @BythanProductions 4 года назад +1

    I spent all morning finishing your OOP walkthrough videos and just ended with this. You, sir, are amazing.

  • @JoeEvansSound
    @JoeEvansSound 7 лет назад +276

    Thank you very much - I have read and read on this subject but was getting totally confused. This video explains things so much better. Thank you very much. Your video is very explanatory and well done. :¬)

    • @coreyms
      @coreyms  7 лет назад +35

      Thanks. Glad to hear you found it useful!

    • @nikhilchigali
      @nikhilchigali 6 лет назад +4

      I agree!!!
      this video clarified my doubts!!

  • @dwainetrain
    @dwainetrain 6 лет назад +4

    Your clarity is a godsend! Thank you for the instruction Schafer Sensei!

  • @anindam9179
    @anindam9179 4 года назад +3

    okay, this person is so nice that he repeated the same thing without sounding repeatative at all. anyway, coming to the point, I think for average,slow,diverted students the video needs to be seen twice or whatever, there's got to be some kind of repeatation; but for focused students he's a great teacher

  • @haiderhani1998
    @haiderhani1998 4 года назад +1

    i've been roaming around for two days now. this is by far the best video i found. just subscribed!

  • @nelsongg347
    @nelsongg347 5 лет назад +15

    THE best explanation on the subject. Thanks Corey!!

  • @4abdoulaye
    @4abdoulaye 4 года назад +46

    Clearest one I ever found and reference my friends.

  • @piyushsharma7585
    @piyushsharma7585 2 года назад

    So simple, so elegant. Loved the way he explained this. I’m not gonna forget this thing in my entire life. Thank you

  • @simonfelix9138
    @simonfelix9138 4 года назад +2

    Crystal clear and very helpful series of videos. You seem to acutely anticipate areas of confusion for an audience who is looking at the topic with a fresh pair of eyes and then proceed to clarify these doubts with simple but complete explanations and back it up with relevant examples. There are loads of online paid courses that fall far short from the level of your videos. Kudos. Wish someone could teach the hosts of instructors and trainers out there to emulate your capabilities, many of these courses seem to frustrate new students more than help them.

  • @Baba-so6fh
    @Baba-so6fh 2 года назад +3

    Finally it makes sense! Great video. So I understand now that the variable __name__ is different depending on whether the Python file is being run directly as a script or if it is imported somewhere else. If someone imports it, you can choose for the contents not to be run.

  • @giorgionapoli85
    @giorgionapoli85 6 лет назад +20

    "So, I really hope this video was useful..."
    Yes man... yes. Big YES. Damn it, thank you!
    And it's not the first time you englightened me.

  • @chilukanand
    @chilukanand Год назад

    Feels so good when you get to decipher __name__ = '__main__'. For years it was a huge mystery and blindly went with the flow. Thanks for the clarity distinguished mate!

  • @abdelhaqfaouzi
    @abdelhaqfaouzi 4 года назад +1

    I'm learning Python on my own and haven't reached the underscored 'thingies', but just watching this video, I understood the whole concept!! Thumbs up!! thx

  • @vinhtranphuc715
    @vinhtranphuc715 4 года назад +25

    Great! You're one of the greatest Python tutor on RUclips

  • @tahep3906
    @tahep3906 5 лет назад +6

    this seemingly complex topic can't be explained better that this, thanks a lot for clarifying it...

  • @yogiblak7819
    @yogiblak7819 2 года назад

    You are quite literally the BEST explainer in the world! You could take any concept and get the most mentally incapable person to understand it. Great job!

  • @Nugeorge
    @Nugeorge 4 года назад

    What an excellent explanation -- I finally had that 'eureka!' moment with this topic after my brain failed to comprehend several other tutorials about this.

  • @sephkm7482
    @sephkm7482 5 лет назад +18

    thos was the best and really honestly ever best explanation for this term I've been always trying to understand! Thanks so so much!!

  • @LuisMan8
    @LuisMan8 8 лет назад +1116

    You say: "Thank for wacht it"...
    I say : Thank for teach me !!!!

    • @sourabhsaini967
      @sourabhsaini967 6 лет назад +6

      You r right

    • @nemplayer1776
      @nemplayer1776 5 лет назад +58

      NemCorrect:
      You say: "Thanks for watching"
      I say: "Thanks for teaching me!"
      Always on service.

    • @ycombinator765
      @ycombinator765 4 года назад +4

      @@nemplayer1776 you did not get the joke!

    • @hanle2566
      @hanle2566 4 года назад +12

      @@ycombinator765 what is the joke? mind to elaborate?

    • @copperymarrow1583
      @copperymarrow1583 4 года назад

      r/whooosh

  • @zaqwsx28
    @zaqwsx28 4 года назад +3

    RUclips recommendations can apparently read my mind. Thanks for covering this topic!

  • @fafza1
    @fafza1 4 года назад +1

    Finally. I had seen that scary double underscore several times and couldn't figure out what it was all about.
    Thank you for the explanation.

  • @EV4UTube
    @EV4UTube Год назад +65

    I have found a way of conceptualizing this line of code in a way that (for me) may be easier to understand ...
    Think of any single individual who is part of a family; we will call this person Xavier.
    Let's talk about the relative terms we use when relating Xavier to the rest of his family.
    His parents consider Xavier to be his SON.
    His sister considers Xavier to be her BROTHER.
    His second-tier relatives consider Xavier to be their COUSIN.
    His grandparents consider him to be their GRANDSON.
    Lastly, Xavier considers Xavier to be HIMSELF.
    Xavier is still the same person in each of these relative relationships, but the relative term we use for him is different depending on who we are relating to.
    So, when we write, "If __name__ == __main__" then we are effectively asking is: "If == HIMSELF"
    If that code evaluates to TRUE, then we know that the program is running on its own - it is referring to itself.
    == "HIMSELF"
    If, however, that code evaluates to FALSE, then we know that the program is running as a component of another program.
    That is, when you run the code "if __name__ == __main__" and it evaluates as FALSE, then it would be **metaphorically** equivalent to the return values being something like the following:
    == "SON"
    == "BROTHER"
    == "COUSIN"
    == "GRANDSON"
    In other words, Xavier is not operating as HIMSELF, he is operating in relation to some other entity (a subcomponent of another program).

    • @FloppyCuber1993
      @FloppyCuber1993 Год назад +6

      this made me confused as hell at the beginning ;) But is a good explanation too.

    • @lvplvp
      @lvplvp Год назад +5

      Wow thank you for the great explanation!!

    • @Mr.Jiggle
      @Mr.Jiggle 9 месяцев назад +1

      it is more like if relative pronoun is not son, brother, etc.. then this is not the main "xavier" it is someone else IMPORTED to this file "family", correct me if im wrong

    • @EV4UTube
      @EV4UTube 9 месяцев назад +1

      @@Mr.Jiggle I dont see a problem with your analogy. However, I also dont see a difference. I feel like you identified a difference with no real distinction. If Xavier is your nephew, he's not your child (you've imported him to your family). But if your approach helps you capture the concept, then run with it.

    • @Mr.Jiggle
      @Mr.Jiggle 9 месяцев назад +1

      @@EV4UTube thanks, i was just making sure that i caught it right, i almost understand rn, thank you again

  • @MrTigerstyle80
    @MrTigerstyle80 4 года назад +3

    THE MOST cogent explanation of python import machinery available IMHO.

  • @ericsteph
    @ericsteph 3 года назад

    Hats off!
    you exaplain it simply and clearly. I have always thought this main story was complicated but thanks to you, now I fully grasp it.

  • @abdulraaziq7055
    @abdulraaziq7055 3 года назад

    This guy explains the best...answers all the questions that appears in the mind while watching...keep going

  • @raj1307
    @raj1307 5 лет назад +11

    I found your explanation best........Thank you so much..!!

  • @lardosian
    @lardosian 6 лет назад +9

    Such a joy listening to your tutorials. The instructor in my paid course just keeps stuttering and mumbling to the point where I lose the will to live. You are a life saver, easily in the top 3 instructors online.

    • @coreyms
      @coreyms  6 лет назад +8

      Thanks! I stutter and mumble a lot as well, but I edit all of that out because I don't want to waste the viewers time. Glad you enjoy the videos!

  • @gambomaster
    @gambomaster 4 года назад +1

    One of the best Python instructor on RUclips. 👍👍👍

  • @sixadamra
    @sixadamra 4 года назад

    5 years later this video is still great. Thanks for this explanation, it clears up the concept perfectly.

  • @gyan2664
    @gyan2664 8 лет назад +56

    perfectly explained ..thx a lot confusion removed ...

  • @pyTechLife
    @pyTechLife 4 года назад +8

    Finally got this. Thank you a lot!

  • @nuutti729
    @nuutti729 3 года назад

    Got recommended two of your videos, this and the working with json data in Python. Both very helpful videos with clear explanations. You earned yourself a new subscriber!

  • @thirumaleshece715
    @thirumaleshece715 4 года назад +1

    Hi Corey Thanks for making these vedios .. You are by far the best Tutor i have ever seen.. Your Flow of teaching basics is brilliant.. not many cover those.. please continue your good work.. Being simple , clear, to the point is the best way in your teaching .. ..

  • @ducpham9991
    @ducpham9991 4 года назад +5

    After three years used python, finally, i know why they use it :)) thanks so much

  • @tnmyk_
    @tnmyk_ Год назад +3

    This is EPIC! Thanks a lot for making this video!

  • @crimepunishment5372
    @crimepunishment5372 Год назад +1

    Corey, Man, you are an asset to humanity indeed, keep the good work.

  • @aatt3209
    @aatt3209 4 года назад +1

    OMG, this is the first time I am getting the concept using __main__, thank you so much for being a great teach!

  • @alexxxxxxxxxxxxxxxxxxxxx
    @alexxxxxxxxxxxxxxxxxxxxx 5 лет назад +3

    Thank you! The presentation of information is very clear!

  • @Sheriff.Movement
    @Sheriff.Movement 4 года назад +179

    Can't get better explanation than this🙏🏼

    • @heron22wading
      @heron22wading 3 года назад +2

      you can have waaaaaaaaay better explanations than this crap. He just wrote shit and didn’t bother to explain new stuff

    • @skull4110
      @skull4110 3 года назад +3

      @@heron22wading fuck off. Writing stuff is exactly what I needed.

    • @jparth1593
      @jparth1593 3 года назад

      Agree

    • @AmitParam
      @AmitParam 3 года назад

      @@dr.rijjaayaz8160 ___

    • @AmitParam
      @AmitParam 3 года назад

      @@dr.rijjaayaz8160 sgs

  • @prathameshpradipdatar2003
    @prathameshpradipdatar2003 5 лет назад +1

    Really liked your way of explanation!! Voice, pace, and clarity of information were perfect.

  • @Waterlmelon
    @Waterlmelon 2 года назад

    This is the best explanation for if __name__ == '__main__' that bothered me every time I saw it in a python code and tried to ignore it and escape from it.
    Thousand thanks!!

  • @tammytreit3877
    @tammytreit3877 5 лет назад +4

    Thanks, clear and super helpful to this beginner!

  • @1377sv
    @1377sv 5 лет назад +4

    brilliant yet concise explanation. ThankYou

  • @user-cx7dm5qq6g
    @user-cx7dm5qq6g 2 года назад +1

    Thanks, this is definitely by far the simplest and clearest explanation I've read.

  • @cass12345
    @cass12345 Год назад +1

    I came here because I was confused by a Udemy course I'm doing - your explanation was fantastic and simple. Thank you.

  • @robodair
    @robodair 7 лет назад +4

    Concise and to the point. Nice :)

  • @susarlaaditya5629
    @susarlaaditya5629 5 лет назад +3

    Subscribed: Man you explained very well!

  • @belacy87
    @belacy87 3 года назад

    Great video. I learned Python from a bootcamp which skipped these essential basics. Very helpful !

  • @ritikaprasai5118
    @ritikaprasai5118 4 года назад +1

    You are the best tutor on you tube! Thank you for your wonderful videos. Please add more videos with real world problems.

  • @yohandarshana
    @yohandarshana 5 лет назад +4

    Very helpfull video , thanks for upload this video

  • @zhencao6115
    @zhencao6115 7 лет назад +3

    Nice man. Thank you for share your knowledge.

  • @thehonestabe
    @thehonestabe 4 года назад +2

    The way you explain it is so clear and very good. I guess because you really wanna teach and your main goal is to teach people and be helpful.
    First video watched from your channel and I subscribed. Thank you very much!

  • @leehouchin2871
    @leehouchin2871 5 лет назад

    Wonderful explanation. As everyone has said, this is one of the best explanations of this topic.
    One thing to add though. I know many here are well versed in Python will know this, but for those new to Python here is an example of why you would employ the 'if __name__ == "__main__" in a module. When you build a module, you will want to test it and make sure it works to spec. The beauty of it is that you never have to remove it and it gives you an easy way to test out your module before importing it into other Python files.

  • @ytb93holmes
    @ytb93holmes 4 года назад +47

    Clear conception.
    And other puzzle is that I'm interested in learning how to execute and preview the result on sublime text after finishing python?

    • @dusanbiga4948
      @dusanbiga4948 4 года назад +3

      Probably figured out by now but sublime is a texteditor and not a IDLE.

    • @NotxarbProd
      @NotxarbProd 4 года назад +18

      CTRL-B

    • @MrinmoyHaloi
      @MrinmoyHaloi 3 года назад

      Change build system to python3 and then ctrl+b

  • @afrankiuk78
    @afrankiuk78 4 года назад +5

    Great explanation! I completed a graduate program in data science and none of the professors explained this as clearly.

  • @rezamostafid8810
    @rezamostafid8810 2 года назад

    Hi Corey, many thanks...all crisp and clear....same sentiments as the previous viewer's comments ( below ).

  • @RuinousGrace
    @RuinousGrace 3 года назад

    It's funny how almost no tutorials I've seen cover this statement, given how incredibly common it is. Thank you very much!

  • @Sabre00
    @Sabre00 5 лет назад +3

    When I found this out at first I couldn't see the usefulness of it but I realized that I could test my modules separately and not have it called within my main program.
    Great explanation as always.

  • @rubialugattimoreira1978
    @rubialugattimoreira1978 Год назад +9

    Best explanation! 👏👏

    • @easydatascience2508
      @easydatascience2508 Год назад

      See mine too. The channel has Python crash tutorials, and R beginning course tutorials. Step by step, sequentially. And you can download all the source files (can be found in the description of the video).

  • @user-hi8vb9uk6n
    @user-hi8vb9uk6n 2 месяца назад

    8 years later and it's still useful! Thank you so much for the amazing video :)!

  • @brianontheair
    @brianontheair 3 месяца назад

    Holy crap I’ve been looking for a good explanation of this for forever. After not understanding when I first started learning I just skipped past it and always ignored it every time I saw it. But today I decided I was going to sit down and understand it and you made it clear. Thank you.

  • @roshanyadav2078
    @roshanyadav2078 5 лет назад +4

    Thanks Corey this was wonderful!! Just a question when I can use this? Any example from any of your practical programs?

    • @nikiffleser2599
      @nikiffleser2599 5 лет назад +1

      I mean you just use it in every programm (module) for the sake of importing it later on.

  • @bhaskartrivedi3114
    @bhaskartrivedi3114 2 года назад +4

    2021: These are future-proof tutorials!

  • @myblurryfaceromance5146
    @myblurryfaceromance5146 4 года назад

    Tried to understand this from my lecturers for 3 weeks. Understood it from your channel after 6 minutes into the video. TYSM

  • @kamaur01
    @kamaur01 4 года назад +1

    I just started learning python. This was the first video that explained it to me. Thank you

  • @Nonplused
    @Nonplused 4 года назад +8

    I'll be watching more of these videos for sure. My 14 year old son is learning to program in Python, but of course in my day Visual Basic was all the thing, so I have a hard time helping him even though I am very good with VB. The syntax is quite a bit different and the way people use Python is also quite a bit different. Even just the fact that logical statements like if, while, for etc. don't need to be terminated but rely on formatting is new to me. No more "end if". Visual Basic is more like Visual Pascal only without dynamic variables. Shows how old I am. And when did we go back to running stuff from the command prompt? It took me an hour to figure out how to get my computer to launch python that way even with the help of a video. Mind you I wasn't very familiar with setting system variables. I also really miss the "Step" debugger function in VB. I found something similar in Python but since half the time you are in imported code I have no idea what it is pointing at. My son would joke "oh look we are at line 1048 of my 50 lines of code". A video on how that works would be great.

  • @rigid9822
    @rigid9822 5 лет назад +3

    thanks mate great explanation

  • @mohinik4473
    @mohinik4473 4 года назад +2

    Ditto...first ever fast explaination
    Loved it👍thank u for ur time

  • @ansariataullah3064
    @ansariataullah3064 4 года назад

    It was very helpful ,I stuck here for 1 day. Your teaching is in very simple simple way easy to understand by any one.......

  • @luijo633
    @luijo633 4 года назад +4

    You just cured my anxiety

  • @KevinKamauk
    @KevinKamauk 5 лет назад +3

    This is god's work at its best. I struggled with this concept but thanks to this 8 minutes i can now continue with my coding.

  • @SAIKRISHNA-yf8qy
    @SAIKRISHNA-yf8qy 4 года назад +1

    Best explanation one could give for this problem. This video was really helpful.

  • @vamsikrishna-cf7tq
    @vamsikrishna-cf7tq 5 лет назад +1

    This is the best explanation to this topic I found till today..thank you very much.

  • @gherbihicham8506
    @gherbihicham8506 5 лет назад +6

    Coming up from a C++ and Java world I use the "if __name__ == '__main__':" functionality almost religiously, even though most of the time I dont need it.

  • @lilJ5754
    @lilJ5754 4 года назад +3

    Very well explained. When would you actually need to use this though? I am having trouble coming up with a good example..

    • @Denis-xl8jx
      @Denis-xl8jx 4 года назад +1

      The only thing I know if is testing. Define a function and test if it works properly.

  • @board_runner
    @board_runner 2 года назад

    Cheers. Finally an explanation that made sense.
    How others have failed to explain _that_ is beyond my imagination.

  • @pkavenger9990
    @pkavenger9990 4 года назад

    This is the best tutorial so far. This thing is kinda tricky one. Sometimes i understand it but when someone ask me to make them understand, i start thinking maybe i did not get the concept, i have to check again.