THANK YOU! This is one of those things people expect you to do but never explain why you have to do it. Like, I can understand that I have to have a main function but show me why and what happens when I don't.
That is crazy as I was typing 'what is if __name__ == __main__' on the search bar, a notification popped up and it was this video. What a coincidence 😂 thanks dude
How are you calling myvalue as global variables at 6:03. When you use if ___name___ == '__main__' then myvalue is definitely not a global variable. You have to use *global myvalue* before defining it to make it global. The error is not at all confusing. Its pretty clear.
i understood this a lot more than what was discussed in the sc50 class! I need to find more simple, basic and vary beginner focused videos talking about how to structure these still though. Thanks for posting this though, it helped with a big part of the confusion on why we use these.
Something confusing to new learners is when you use .py names that are duplicative of non dynamic syntax. Calling the .py "main" when the if statement is not referring to the .py named main causes confusion. A new user will see that and attempt to change '__main__' to reference the .py they are trying to call the functions from. Otherwise, very good video.
Love ❤ for ur efforts and ur content In future I am expecting videos on Frontend roles and Responsibilities like 1. What actually do frontend developers do in realtime ( different tasks) 2.. How manage 4+ experience in realtime 3. . How to crack any frontend interviews with 4+ years of experience 4.....Easy way to to crack any angular/reactjs interviews with 4+ experience/10lack package ------) )) 5....Top 20 program's to cover entire angular/reactjs syllabus.----)) 6....Top 10 angular/reactjs concepts with examples
Bro, there are two possibilities, either you’re fucking genius teacher or others are terrible craps doing it. Whatever the answer is, as many others here i finally understood this concept after a few hours of unsuccessful researches.
THANK YOU! This is one of those things people expect you to do but never explain why you have to do it. Like, I can understand that I have to have a main function but show me why and what happens when I don't.
I have done a lot of reading and practicing in Python never could understand the dunder thing was and now it finally clicked for me. Thanks, man!
That is crazy as I was typing 'what is if __name__ == __main__' on the search bar, a notification popped up and it was this video. What a coincidence 😂 thanks dude
Thats google cookies for you. Really useful but CAN be used for something else. I know it doesn't but it can.
google is spying on you...
@@ninjacodertech yes, but you're too boring for them to really look what you're doing.
@@dogwithwatergun1546 what is wrong with you
@@ninjacodertech google is spying on you... like yes its 2021, if you want privacy you should start by deleting youtube.
BRILLIANT! After watching at least 10 other tutorials, I FINALLY undersand this concept. Great teaching skills and great style, keep it up ;)
I’ve watched a few videos about this and by far you have the most clear understandable explanation
How are you calling myvalue as global variables at 6:03. When you use if ___name___ == '__main__' then myvalue is definitely not a global variable. You have to use *global myvalue* before defining it to make it global.
The error is not at all confusing. Its pretty clear.
Ya i thought the same it's in if statement scope
Only if inside a function, otherwise its implied to be global
my mind just exploded, I see lots of people using it but never had seen someone explaining it, thanks a lot!
Thanks, I watched 5 other RUclips videos on this topic and your video explained this topic the best.
i understood this a lot more than what was discussed in the sc50 class! I need to find more simple, basic and vary beginner focused videos talking about how to structure these still though. Thanks for posting this though, it helped with a big part of the confusion on why we use these.
I like this man how he starts his videos and his explanaition. he looks fynny but serious. i expect more on python GUI
Awesome!
I had needed this in my project and I didn't know how to do it...
Thanks again!
at 6:09, `myvalue` was still undefined even though it was globally defined. why was it so?
YOU'RE TOO GREAT buddy, thanks for dissecting these python notions like that..
Finally understood why we use it!
Thanks Man!
You are the best teacher I have found. You are a genius. Thank you
The best explaination I could find! Thanks a lot
Bruh, are you reading my mind or something? Just got lectured on the Python Subreddit yesterday for not using Main on a script I posted there, lmao
I'm from Harvard CS50, intro to python programming, this video has helped me a lot. Thanks
Very nice and detailed explanation...thank you so much
yeah I agree with other comment - saw other videos on this topic and I think your explanation was best. thanks.
Thank you this was the best explanation for this topic!
Best explanation of this in Yt
protect this man at all costs
Shouldn't the if __name__ == "__main__" expression be only inside the "main" script? Not in "mylibrary"...
Exactly the answer I was after, thanks 👍👍
Something confusing to new learners is when you use .py names that are duplicative of non dynamic syntax.
Calling the .py "main" when the if statement is not referring to the .py named main causes confusion.
A new user will see that and attempt to change '__main__' to reference the .py they are trying to call the functions from.
Otherwise, very good video.
This video helped me a lot!! Thank you!
Thanks :) I just counted on that I could find a video with you explaining this :D
Thanks so useful! And so easy to understand
great help man!! appreciate it !!
There is just one word to describe you guy : AWESOME.
Great tutorial. I do have a question. Don’t you need the keyword “global” to turn a variable into a global variable ?
Yeah...even I was thinking of that
no, it's just what we call the variable.
Only if inside a function, otherwise its implied to be global
beautiful, thanks a lot!!!
What theme are you using in pycharm ,bro 🤔
Thanks for this! :)
Can you make video about Jython(Java + Python)
This was really interesting. Thanks!
Dude! WTH dude! thank ****! much love bro thanks
Great explanation 🔥
Thank you so much!
so variable can't define as globally, but can define in local. And no error?
Great, help me to understand. Hugs from Brasil
Love ❤ for ur efforts and ur content
In future I am expecting
videos on Frontend roles and Responsibilities like
1. What actually do frontend developers do in realtime ( different tasks)
2.. How manage 4+ experience in realtime
3. . How to crack any frontend interviews with 4+ years of experience
4.....Easy way to to crack any angular/reactjs interviews with 4+ experience/10lack package ------) ))
5....Top 20 program's to cover entire angular/reactjs syllabus.----))
6....Top 10 angular/reactjs concepts with examples
Great explanation
please do a Cython tutorial , and a question , is Cython more practical to use than CPython?
Yes
@@IzUrBoiKK Do you use it? can it actually make python code run in C code speed?
can you do some tutorials of pillow?
Do the Nvim tutorial of the COC implementation or the new LSP of the Neovim 0.5 :(
Thank you s so much!
Great video.
You are awesome!😃
why do if __name__ == '__main__': not throw valueerror forexpecting else:
Bro, there are two possibilities, either you’re fucking genius teacher or others are terrible craps doing it. Whatever the answer is, as many others here i finally understood this concept after a few hours of unsuccessful researches.
Read a few online tutorial, nothing made sense.. this short video did in 5 mins
That's what I try to accomplish :)
grate job
ohhhhh this makes sense
excellent video. Tweeted.
for all main part lol
Is sumeet your Friend
🤯bro
Thx_.
first