If __name__ == "__main__" for Python Developers

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 มิ.ย. 2024
  • If name equals main - then we run our programs!
    But do we actually understand what is _name_ , what is _main_ and most of all - why do we need to check if they match? 🤔🤔🤔
    I've prepared this very special tutorial that dives deep into each component and demonstrates it thorough simple code examples. By the end of this video - you'll be able to explain this expression in your own words (!!!) as well as other terms like "module" and even "top level code" 😉
    ⏰ TIME STAMPS ⏰
    ------------------------------------------
    00:00 - Intro
    00:29 - What is _name_
    00:59 - What is module?
    01:34 - Top level code vs imported code
    03:35 - What is _main_
    05:08 - Find the value of _name_
    05:55 - Why do we need to check if name == main
    08:08 - Thanks for watching!
    🤝 Connect with me 🤝
    --------------------------------------
    🔗 Github:
    github.com/mariyasha
    🔗 Discord:
    / discord
    🔗 LinkedIn:
    / mariyasha888
    🔗 Twitter:
    / mariyasha888
    🔗 Blog:
    www.pythonsimplified.org
    🎯 Sources 🎯
    --------------------------------------
    ⭐ Python Documentation:
    docs.python.org/3/library/__m...
    💳 Credits 💳
    ----------------------
    ⭐ Beautiful animated graphics by:
    mixkit.co
    ⭐ Beautiful icons by:
    flaticon.com
    #python #pythonprogramming #python3 #pythonforbeginners #if #main #coding #programming #pythontutorial #conditioning #pythonsimplified #module #toplevel #code
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 672

  • @xklojx
    @xklojx 17 วันที่ผ่านมา +4

    The most gorgeous python teacher with most synthesized way of teaching, keep it up

  • @anthonyoppong-gyebi2880
    @anthonyoppong-gyebi2880 ปีที่แล้ว +123

    Did you guys watch the video at all before commenting? Please watch it. That's how you will learn. She is here to educate, not for fans.

    • @S3R43o3
      @S3R43o3 ปีที่แล้ว +8

      Well dude as is know the Internet the Most dudes are Here , an i hate to say That cause sexism is Not my opinion but she is a attractive Woman and the Most Boys going Crazy if they See a beautyfull Girl on screen … its like twitch Girls … youre right she is very competent and i learned a lot from her

    • @htruth1785
      @htruth1785 ปีที่แล้ว

      She’s hot AF that’s why clicked. But I stayed for her enthusiasm, knowledge and style of teaching.

    • @S3R43o3
      @S3R43o3 ปีที่แล้ว

      @@htruth1785 Mhm you Need to know when its better to shut up and keep fingers away from keyboard… but thanks for the next men That keep this ugly aditute and the cockbrainer style… how u get Into IT with 3 mumbles That Collide uncontrolled ? Please… sit and go for pornhub … 😓

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +36

      Don't worry Anthony, it doesn't mean they don't watch it, they just choose to comment on my looks instead of the content 😊
      I don't really have a problem with that - I'd always take a subconscious learning process over nothing! hahahaha they don't notice but the info still sinks in 😅😅😅

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +48

      @@S3R43o3 What many women consider sexism nowadays - used to be called courtship, and it was a very desirable behavior 😉
      Nowadays it's "how dare you compliment me?? this is so disrespectful!!! I'll go complain to my 70 cats, they understand me so well..." 🤣🤣🤣

  • @supermalavox
    @supermalavox ปีที่แล้ว +220

    I like it when youtubers describe their code(s) verbally as they go along. For a blind person such as myself, it is of great help, since screen readers normally don't speak the contents inside videos, only in their descriptions, so if you say what you are doing while you write/show the code, the explanation becomes accessible!
    Thanks and keep up the good work!

    • @WhiteNight0204
      @WhiteNight0204 ปีที่แล้ว +11

      Please don't take this question as offensive, as I am only intrigued, but you program while being blind? Is it actually doable?

    • @RAP4EVERMRC96
      @RAP4EVERMRC96 ปีที่แล้ว +8

      @@WhiteNight0204 I am not an expert in accessibility features, but I remember from my time at apple that on a regular blind or visually impaired people would come in to give their Mac to service. They were able to fully control their computer due to the accessibility features and additionally there were experts in the store that knew how to use these features. So I guess as long as you can control a computer you can program on it.

    • @supermalavox
      @supermalavox ปีที่แล้ว +27

      @@RAP4EVERMRC96, thanks for the help in replying! I will add that while blind people might not be the greatest in GUIs in terms of object positioning, colors, etc, we can definitely build working functions and even deal with oop. Also, the screen reader that comes with Linux/GNOME - Orca - and one we use on Windows - NVDA - are both programmed in python! And as far as I know, NVDA's original developer - Mick Curran - is blind.
      I myself am not a professional programmer, but like to learn something on Codewars, Exercism, etc.

    • @rikkilleen3169
      @rikkilleen3169 ปีที่แล้ว +7

      Rock on, my guy. You are an inspiration.

    • @supermalavox
      @supermalavox ปีที่แล้ว +6

      @@rikkilleen3169, I will consider myself an inspiration when I become more than a newbie programmer, but thanks for the motivation!

  • @JorgeEscobarMX
    @JorgeEscobarMX 24 วันที่ผ่านมา +2

    This is the best explanation of this boilerplate code I had watched so far.

    • @PythonSimplified
      @PythonSimplified  24 วันที่ผ่านมา

      Thank you so much! glad you liked it! :)

  • @michalbotor
    @michalbotor ปีที่แล้ว +49

    you've achieved mastery in clean, logical, and engaging explanations of programming concepts. my understanding of the topic has increased substantially. thanks so much mariya!

  • @NikilPaul-pc9rz
    @NikilPaul-pc9rz 20 วันที่ผ่านมา

    Are you for real? This is the best explanation out there!! Contains everything i ever wanted,why its used and what it is doing! Thanks sensei!!

  • @MrKrtek00
    @MrKrtek00 ปีที่แล้ว +5

    This was actually way more insightful than I expected... Thanks, great explanation!

  • @ssloc
    @ssloc ปีที่แล้ว +4

    So thorough with great examples/visuals! Great job 👏. I look forward to more.

  • @mirandaenergypark5271
    @mirandaenergypark5271 ปีที่แล้ว +2

    Excellent explanation! You have included some essential features of this statement that makes it all so much more understandable, unlike many other explanations I have seen on TH-cam. Thanks!

  • @MrIsaacpr7
    @MrIsaacpr7 6 หลายเดือนก่อน

    I’m really enjoying your videos a lot. I’ve been wondering why I write that exact line of code for weeks, with no clue as to why. Once again, you nailed it! Your way of explaining things in a digestible manner for a total beginner is unparalleled. Thank you for sharing.

  • @michaeltheisen
    @michaeltheisen 17 วันที่ผ่านมา

    The example at the very end with "from import_me import call_me" that showed it running the function just because it was imported, really helped me solidify the concept. Thank you! And thank you for all your quick videos on good python habits and explanations like this. They really do help us get through some of our projects after we've been out of the game for so long.

  • @Richie.P71
    @Richie.P71 ปีที่แล้ว +6

    I have been wondering this for ages, thank you for breaking it down so simply. You are the best!!

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +1

      Thank you Richie! I'm super happy you found it helpful! 😀

  • @deniskasala8520
    @deniskasala8520 ปีที่แล้ว

    I used to scroll down and pass your videos but now i am hooked as your methods of teaching is really easy. Thanks again

  • @portinho199
    @portinho199 ปีที่แล้ว +1

    As always, the best and cleary explanation from entire TH-cam platform. Thank you so much!!!

  • @jcmschott1895
    @jcmschott1895 ปีที่แล้ว

    Amazing content! Pleeease keep it up! You built it up like a crescendo and suddenly became crystal clear why this "if __name == __main__:" stuff is so necessary.

  • @PARTner91
    @PARTner91 ปีที่แล้ว

    If only everyone could explain things as clearly as you do. Nice job, thank you.

  • @arthurbosquetti
    @arthurbosquetti ปีที่แล้ว +2

    This was such a good video! I've always been curious about this, but never really looked it up. Now it makes sense :) Thanks for the clear explanation!

  • @asmitaghorai7332
    @asmitaghorai7332 2 หลายเดือนก่อน

    This was actually a brilliantly executed lesson plan! Profuse thanks to you.
    Never thought I'll come across such content on TH-cam and for absolutely free of cost oml, once again I'd like to screech out loud, this is straight off GREAT!

  • @trong-tintran6262
    @trong-tintran6262 4 หลายเดือนก่อน +3

    I am a French developer, beginner in python, and your tutorial is extremely clear, I understood everything!
    I often avoid English tutorials because the TH-camr speaks quickly and I have trouble following but here I have nothing to complain about, your English is simple and easy to understand. I subscribe to your channel +1.
    Thank you very much for this wonderful work. This is the first time I've posted a message on TH-cam in my entire life 😂 but it's well deserved !👏🙏

  • @lukajeliciclux3074
    @lukajeliciclux3074 ปีที่แล้ว

    So much quality in this video. Simply perfection. Even thought I know a lot about if __name__ == '__main__' I found an additional information I've never know.

  • @xr6694
    @xr6694 5 หลายเดือนก่อน +1

    this is by far the most professional guide I've seen on this topic. this girl is serious

  • @ClaudiaWick
    @ClaudiaWick ปีที่แล้ว +1

    excellent explanation! I already tried for longtime to understand the basics of this statement, not only demonstrations of what happens with or without it. Thank you to spend more time than others to explain this for beginners: it is really helpful!

  • @ad.chacon
    @ad.chacon ปีที่แล้ว

    I just clicked this video bc I started learning Python yesterday, I have never seen a if __name__ = "__main__" in my life, yet you managed to make me understand how this works and why is it this way.

  • @KBIZWORLD
    @KBIZWORLD ปีที่แล้ว +2

    I found this super helpful. Watched a few explanations of the name = main thing but this was the first one that made perfect sense. Thanks so much !!

  • @hondacars8444
    @hondacars8444 ปีที่แล้ว +4

    Great video. Thorough yet succinctly presented. Awesome job 👍🏻

  • @NoOne-L
    @NoOne-L ปีที่แล้ว +4

    Wow! Your channel was recommended to me a few months back and I kept passing it. Glad I finally watched 1 of your video. You’re such a great teacher. You make complex stuff simple. Thanks and will watch more videos from you

  • @hawardjoseph2201
    @hawardjoseph2201 9 หลายเดือนก่อน

    Your explanation is super great!!! I haven't anywhere seen such a great explanation, in my mind makes your teachings remember quite easy. Thank you so much and please continue making more and more videos for the world.

  • @bobursuyunov00
    @bobursuyunov00 ปีที่แล้ว +1

    This is the first video that I watched from your channel, and I love your teaching techniques

  • @amrosamier8547
    @amrosamier8547 ปีที่แล้ว

    I'm new to programming and I've already started learning python, this is the first video i watch on your channel and I'm amazed by how you simplify the information,
    Thanks a lot and keep going

  • @KingsleyOsborn
    @KingsleyOsborn ปีที่แล้ว

    I like how you slow down and try to speak as clearly as possible! Great info, thz!!

  • @aspsa6246
    @aspsa6246 6 หลายเดือนก่อน

    Much appreciated. I always enjoy tutorials that provide the rationale for doing something rather than just droning on about how to do something.

  • @Itamar960
    @Itamar960 ปีที่แล้ว

    I have to say, the last chapter (the example) was the best presentation for this guide - now it makes sense. TNX!

  • @EmaMazzi76
    @EmaMazzi76 ปีที่แล้ว +63

    Your lessons Mariya really worth every seconds spent…watched dozens of videos regarding this topic (if __name__ == “__main__”…) and for the very first time I understand what it does actually 😄 thank you, thank you, thank you

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +8

      Yeeeeeeyyy Emanuele, I'm so happy to hear that!!! 😀
      For a very long time I understood the general concept, but after making this tutorial - you can wake me up in the middle of the night with a surprise quiz - and besides me being a bit grumpy I'll probably get an A+! hahahaha 🤣🤣🤣
      Anyhow, I really enjoyed making this one and super glad you found it useful! 😊

  • @Jamaipanese
    @Jamaipanese ปีที่แล้ว

    thank you! I finally understand it simply. You do such an amazing job breaking things down without being condescending like others do.

  • @sixstringmania
    @sixstringmania ปีที่แล้ว

    ahhhh,,, this is the best channel for python i think. Clarity of voice , compression in sound, great examples and graphics and fantastic teaching skills!!

  • @randysmith4964
    @randysmith4964 ปีที่แล้ว

    Out of all the TH-camrs your explanations really are the best!

  • @kevinlandivar1373
    @kevinlandivar1373 ปีที่แล้ว +2

    Just found this channel. The content is great. Love python! Thank you for making these videos

  • @JulioTalaveraMe
    @JulioTalaveraMe ปีที่แล้ว

    I can understand everything you say easily. Your accent when speaking is very clear and easy to translate. The explanation is very clear and specific, thank you. 👌🏻

  • @NIGHTCASTERS
    @NIGHTCASTERS ปีที่แล้ว

    Best teacher on youtube ! I can follow your code and you make all easy to understand, and what a Beauty too!

  • @Neotenyx
    @Neotenyx ปีที่แล้ว +1

    Holy moly! Two days ago I was figuring out what this idiom was for and now you post about it, it's amazing.

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +1

      I caught you at the perfect timing!!! 😉
      Thank you so much, Otar!

  • @hiutale
    @hiutale ปีที่แล้ว +50

    I'm purely amazed by your explanations! I only had to backtrack (a bit) once to understand all of it even though I'm still a beginner. You are the hero function we needed to call! 😭😭🥺❤️🙏✨

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +9

      Yeeeyyyyyy! Thank you so much for the incredible feedback, hiutale!! 😁😁😁
      I always enjoy reading your comments and I'm super happy you find my videos useful!
      A few more Python projects to experiment with - and you'll be able to ditch the beginner status in no time 😉

  • @RunePedersen
    @RunePedersen ปีที่แล้ว +12

    What a super wonderful and crystal clear way of explaining. :-)
    Thanks lot Mariya!

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +1

      Thank you so much Rune! I'm super happy you enjoyed this tutorial! 😃😃😃

  • @ALFATAVR
    @ALFATAVR ปีที่แล้ว

    I haven't heard such clear and beautiful English pronunciation in a long time

  • @tamasszuper7577
    @tamasszuper7577 ปีที่แล้ว

    I watched around 5 different videos about it but never understand it. Finally, now I get it.
    Thank you

  • @alcidesmarcano
    @alcidesmarcano ปีที่แล้ว

    The best explanation I ever seen so far on this topic… Thanks!!!

  • @flomakinas
    @flomakinas ปีที่แล้ว

    Girl i I'm love with your content and with python thanks to you. Nice work! You explain very well. Usually i watch in 1.5 speed but with your videos i dont even need that because you explain in the perfect speed. Keep up the awesome work!

  • @issafares1830
    @issafares1830 6 หลายเดือนก่อน

    I've seen many videos explaining ( if __name__=__main__) and frankly, this is the most understandable one. thanks

  • @bluehawkfire55
    @bluehawkfire55 ปีที่แล้ว

    Jesus that was so damn clear. I actually understood it without rewinding it. The examples were so crucial and clear. Loved it!

  • @rodm5754
    @rodm5754 ปีที่แล้ว +1

    A very clear, concise, and well presented lesson. Bravo.

  • @tastonic30
    @tastonic30 ปีที่แล้ว

    you always go beyond the things i expect to get ..much love Prof

  • @christopherbenner7516
    @christopherbenner7516 ปีที่แล้ว

    I learned a lot from this. I had seen the code described, but never fully understood. Thank you.

  • @azizurrehman9365
    @azizurrehman9365 ปีที่แล้ว

    I didn't know about this before, you attracted my attention, first I hot confused, but at the end you finally solved everything. Thanks teacher.

  • @powersprouter
    @powersprouter ปีที่แล้ว

    SO clear and concise. Thank you!!

  • @rojerdu2759
    @rojerdu2759 ปีที่แล้ว

    This is the best explanation of if __name__ == '__main__' that I've seen to date. Thanks a lot! 🤗🤗🤗

  • @brentsimpson3791
    @brentsimpson3791 ปีที่แล้ว

    Thank you, that's the best explanation of how this works that I've found...

  • @dmuhsin
    @dmuhsin ปีที่แล้ว

    OMG!!! I can't believe I never really understood this until now. THANK YOU for this video

  • @phil5293
    @phil5293 ปีที่แล้ว

    I have to admin Mariya you're the best. I have been a developer for 25+ years and I'm trying to learn Python this late and only your tutorials make a lot of sense. I might me a Python programmer ONLY in the future if I go through all your numerous videos! Thanks Mariya.

  • @adolfocastro3832
    @adolfocastro3832 หลายเดือนก่อน

    Amazing explanation. Thanks you so much! Thumbed up and suscribed, this was amazing.

  • @75blackviking
    @75blackviking ปีที่แล้ว

    Great explanation! I originally misunderstood, and oversimplified. This helped straighten out both problems. Excellent channel, by the way!

  • @guibraproductions2120
    @guibraproductions2120 7 หลายเดือนก่อน

    Wow, you explained it so clearly, thank you!!

  • @danieljulien4099
    @danieljulien4099 ปีที่แล้ว

    such a brilliant video/explanation! i'm starting to learn python and i've ran into this if __name__=="__main__" 2 times already and didn't really understand it.. now i do!!! thank you very much!! (and this will sound very random lol but you have a great speaking voice!)

  • @311DaveR
    @311DaveR 4 หลายเดือนก่อน

    Great explanation, I had this explained to me before but it wasn’t entirely clear, and this makes it much more clear. Now I totally get it. Thanks, great resource!

  • @horus4862
    @horus4862 ปีที่แล้ว

    That is the first time I understood that. Thank you so much for being a great teacher.

  • @Larimuss
    @Larimuss ปีที่แล้ว +1

    Great video. Good to see coding videos that really define things properly. Which is in my opinion the best way to learn

  • @Antebios
    @Antebios ปีที่แล้ว

    OMG! Thank you for explaining it so succinctly.

  • @renatomachelett
    @renatomachelett ปีที่แล้ว +9

    That was very well explained. An incredible amount of work goes into eight minutes of content when you want it to be clear and concise. I really appreciate the effort. Thank you! 👍🏻👍🏻

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +4

      Thank you so much for pointing it out Renato! 😀😀😀
      This video was 2 weeks in the making and I kept re-filming and revising it until I was 100% happy with the results! (it happens rarely! usually I'm ok with 95% 😅 hahaha)
      I'm so happy you liked this tutorial and you appreciate all the hard work that was put into it!
      Thanks again for the incredible comment! 😊

    • @renatomachelett
      @renatomachelett ปีที่แล้ว

      ​@@PythonSimplified I'm really happy that I got the opportunity to point it out! ☺
      Much of the time, people just consume without considering the energy that is necessary to create something excellent. Whenever I notice the lengths that someone must have gone to in creating something exceptional, instead of giving in to mediocrity, I try to let them know that I know. It needs to be said and more people need to say it!
      So, once again, thank you very much for the wonderful product of your exemplary work ethic! 👏🙏

  • @clairerovic
    @clairerovic 5 หลายเดือนก่อน +1

    The minute this video finished - I subscribed and gave it a thumbs up.

  • @jesusbvasquezq6597
    @jesusbvasquezq6597 4 หลายเดือนก่อน

    Marvelous explanation, thanks for this!

  • @sangaytamang7005
    @sangaytamang7005 ปีที่แล้ว

    Thank you very much to you and youtube for suggesting me this content.

  • @LearnSomethingHelpful
    @LearnSomethingHelpful ปีที่แล้ว

    I could listen to hear all day...so well spoken & helpful

  • @alaly2410
    @alaly2410 ปีที่แล้ว +28

    Over 10+ of python experience and I’m a proud active fan and follower. I love your teaching style, contents, personality and simply everything about you. Thank you so much for everything ❤

    • @PythonSimplified
      @PythonSimplified  ปีที่แล้ว +3

      Wow, Alaa! Thank you so much for the incredible comment!!! 😀😀😀 I'm honored to have you onboard and so happy you enjoy my videos! I still have lots of things to learn, and getting feedback from professional developers with so many years of experience is one of my favourite perks in running this channel! 😉
      Thanks again and I hope to see you soon in future videos! 😊

    • @felipegutierre7037
      @felipegutierre7037 ปีที่แล้ว

      Totally agree!

  • @psyhopatsl
    @psyhopatsl ปีที่แล้ว

    last minute explained me everything! Thanks

  • @rangabharath4253
    @rangabharath4253 ปีที่แล้ว

    Awesome as always. Thanks for the clear explanation with examples. Very easy to understand 🙂

  • @patrickarmer937
    @patrickarmer937 7 หลายเดือนก่อน

    Love the examples, they really helped make it click

  • @ammadkhan4687
    @ammadkhan4687 ปีที่แล้ว

    Man, you're Best!!! no one could explain so well

  • @mbag012
    @mbag012 ปีที่แล้ว

    Instead of watching my normal binge videos, I binge your videos. Your content is amazing.

  • @andreaguerri.educational
    @andreaguerri.educational ปีที่แล้ว +1

    Bella e brava, complimenti!!! Ottima insegnante

  • @felipegutierre7037
    @felipegutierre7037 ปีที่แล้ว

    Clearly explained, I loved it!

  • @axlrose5082
    @axlrose5082 ปีที่แล้ว

    I felt so illuminated at 7:35 LMAO.
    Thanks for the fantastic visual explanation!

  • @yu-chengchang6011
    @yu-chengchang6011 10 หลายเดือนก่อน

    Thank you! Your video explains the concept really clearly!

  • @kozark875491
    @kozark875491 ปีที่แล้ว +1

    Great vid! Super clear explanation! Thank youuu!!!

  • @dileebandileeban7188
    @dileebandileeban7188 หลายเดือนก่อน

    there cannot be a another great explanation than this .superrrrb.❤liked it

  • @mkhadka123
    @mkhadka123 ปีที่แล้ว

    truly amamzed by the explanation, had some idea regarding __name__ and __main__ but never knew there were so many other things to learn such as top level code and top level environment. Many thanks Mariya :)

  • @Chernikru
    @Chernikru ปีที่แล้ว

    Thank you. I was just looking for information on this topic. And you recently released a video. Exactly what is needed!)
    I would like to hear about "poetry" in the following videos. In particular, about the work of scripts through a short name, for example, as "poetry run short-name-script"

  • @python_by_abhishek
    @python_by_abhishek ปีที่แล้ว

    Wow. Crystal clear explanation. Instantly subscribed.

  • @annabarachanou7124
    @annabarachanou7124 5 หลายเดือนก่อน

    One of the most helpful videos on this

  • @Crakkovia
    @Crakkovia ปีที่แล้ว

    Very clear! many thanks Mariya!

  • @ITInsights101
    @ITInsights101 4 หลายเดือนก่อน

    The best Video so far on TH-cam. Thank you my colleague for the amazing

  • @petermuller608
    @petermuller608 ปีที่แล้ว

    I actually figured that much but never bothered to actually look it up. Now I know for sure thanks

  • @patrickhollywood93
    @patrickhollywood93 ปีที่แล้ว

    Thank you for addressing this information. I am about 20 days into my 100 days of code journey and i was wondering exactly what the __name__ module was as well as exactly what modules were. Thx -
    🦋 💎🔥✍

  • @epicrodtezla3228
    @epicrodtezla3228 7 หลายเดือนก่อน

    👍 best explanation of the __name__ variable have seen thanx

  • @brittneyboone2993
    @brittneyboone2993 ปีที่แล้ว

    I really enjoyed watching your video. I like the way you break things down. Thanks.

  • @jasonmulligan7059
    @jasonmulligan7059 ปีที่แล้ว

    Well explained again ! Thank you very much 😊

  • @linuxrobotgeek
    @linuxrobotgeek ปีที่แล้ว

    Mystery has been solved thank you. Way easier than the explanations on forums like Stack overflow.

  • @alaue
    @alaue ปีที่แล้ว

    Thanks a lot for that explanation, the best one i've seen so far!

  • @Akshay-rc9lq
    @Akshay-rc9lq ปีที่แล้ว

    You saved me. Now I'm able to understand the use of __name__ == "__main__"

  • @slademeister
    @slademeister ปีที่แล้ว

    fantastic! Very clear indeed. Thank you!😀

  • @photonics6060
    @photonics6060 5 หลายเดือนก่อน

    Very well explained! Thanks👍👍

  • @jeffreyhunter4115
    @jeffreyhunter4115 ปีที่แล้ว

    Very well done. Thank you for the effort you put into this tutorial.

  • @crash1013
    @crash1013 ปีที่แล้ว +3

    I leaned C a few years after it was released and then C++ to write GUI programs for Windows 3.11 on MFC 1.0. The topic of this video is the thing about all previous programming languages that I always felt was missing.You present it a very clear manner.

    • @CallousCoder
      @CallousCoder ปีที่แล้ว

      Or a good sensible syntax and entry point handling function called main, just like in C, C++, Rust 😂

    • @crash1013
      @crash1013 ปีที่แล้ว

      @@CallousCoder main was certainly in C and well structured assembly language programs, Python rides on top of a gold mine of C libraries that do everything you need. The difference IMHO is that when you have a file based module in Python it is syntactically and semantically handled the same as any other library unit. That is my point and that is what I always missed in C. C has always given you the ability to code as callously as you wish. But you should know that.
      My Python program entries are always the same. Just like a well written C program
      What was not mentioned here if you do not structure you code like this you are running the risk that __del__ for class instances may not get called.
      def main():
      result = 0
      return result
      if __name__=="__main__":
      exit(main())