René's URL Explorer Experiment


Title: Defining Main Functions in Python: Overview (Video) – Real Python

Open Graph Title: Defining Main Functions in Python: Overview – Real Python

Description: Hi, I’m Rich Bibby with realpython.com. Many programming languages have a special function that is automatically executed when an operating system starts to run a program. This function is usually called main() and must have a specific return type…

Open Graph Description: Hi, I’m Rich Bibby with realpython.com. Many programming languages have a special function that is automatically executed when an operating system starts to run a program. This function is usually called main() and must have a specific return type…

Opengraph URL: https://realpython.com/videos/python-main-function-overview/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
  {
    "@context": "https://schema.org",
    "@type": "VideoObject",
    "name": "Defining Main Functions in Python: Overview",
    "description": "Hi, I’m Rich Bibby with realpython.com. Many programming languages have a special function that is automatically executed when an operating system starts to run a program. This function is usually called main() and must have a specific return type…",
    "thumbnailUrl": ["https://files.realpython.com/media/Python-Main-Function_Watermarked.5b31a1de4516.jpg"],
    "uploadDate": "2020-03-10T14:00:00+00:00",
    "duration": "PT2M1S",
    "embedUrl": "https://realpython.com/videos/python-main-function-overview/embed/",
    "potentialAction": {
      "@type": "SeekToAction",
      "target": "https://realpython.com/videos/python-main-function-overview/#t={seek_to_second_number}",
      "startOffset-input": "required name=seek_to_second_number"
    }
  }
  

authorReal Python
theme-color#18354c
color-schemelight dark
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Python-Main-Function_Watermarked.5b31a1de4516.jpg
og:imagehttps://files.realpython.com/media/Python-Main-Function_Watermarked.5b31a1de4516.jpg
twitter:creator@realpython
og:typevideo.episode
og:site_nameReal Python
apple-mobile-web-app-titleReal Python

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/courses/python-main-function/discussion/
Your Learning Plan →Your personalized Python learning planhttps://realpython.com/account/learning-plan/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest&_from=nav_library
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/search?kind=exercise&kind=quiz&_from=nav_library
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Mentor AI →NewYour personal Python mentorhttps://realpython.com/mentor/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Live Courses →Live, instructor-led Python courseshttps://realpython.com/live/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Unlock All Content and Become a Python Expert →Get unlimited access to all Real Python has to offerhttps://realpython.com/account/join/?from=navbar_learn
Unlock All Content →Become a Python Experthttps://realpython.com/account/join/?from=navbar_learn
More https://realpython.com/courses/python-main-function/discussion/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Contributorhttps://realpython.com/jobs/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?intent=navbar&next=%2Fvideos%2Fpython-main-function-overview%2F
https://realpython.com/courses/python-main-function/#team
Defining Main Functions in Pythonhttps://realpython.com/courses/python-main-function/
Rich Bibbyhttps://realpython.com/courses/python-main-function/#team
Recommended Tutorialhttps://realpython.com/python-main-function/
Course Slides (.pdf)https://realpython.com/courses/python-main-function/downloads/main-slides/
Sample Code (.zip)https://realpython.com/courses/python-main-function/downloads/main-code/
Ask a Questionhttps://realpython.com/courses/python-main-function/discussion/#discussion
https://realpython.com/feedback/survey/course/python-main-function/liked/?from=lesson-title
https://realpython.com/feedback/survey/course/python-main-function/disliked/?from=lesson-title
Contentshttps://realpython.com/courses/python-main-function/discussion/#description
Transcripthttps://realpython.com/courses/python-main-function/discussion/#transcript
Discussionhttps://realpython.com/courses/python-main-function/discussion/#discussion
Sample Code (.zip)https://realpython.com/courses/python-main-function/downloads/main-code/
Course Slides (.pdf)https://realpython.com/courses/python-main-function/downloads/main-slides/
00:00https://realpython.com/courses/python-main-function/discussion/#t=0.51
Hi, I’m Rich Bibby with realpython.com.https://realpython.com/courses/python-main-function/discussion/#t=0.51
Many programming languages have a special function that is automaticallyhttps://realpython.com/courses/python-main-function/discussion/#t=3.33
executed when an operating system starts to run a program.https://realpython.com/courses/python-main-function/discussion/#t=6.96
00:10https://realpython.com/courses/python-main-function/discussion/#t=10.65
This function is usually called main() and must have a specific returnhttps://realpython.com/courses/python-main-function/discussion/#t=10.65
type and arguments according to the language standard.https://realpython.com/courses/python-main-function/discussion/#t=14.85
On the other hand,https://realpython.com/courses/python-main-function/discussion/#t=17.994
the Python interpreter executes scripts starting at the top of the file,https://realpython.com/courses/python-main-function/discussion/#t=19.38
and there is no specific function that Python automatically executes.https://realpython.com/courses/python-main-function/discussion/#t=23.82
00:28https://realpython.com/courses/python-main-function/discussion/#t=28.41
Nevertheless,https://realpython.com/courses/python-main-function/discussion/#t=28.41
having a defined starting point for the execution of a program is useful forhttps://realpython.com/courses/python-main-function/discussion/#t=29.34
understanding how a program works.https://realpython.com/courses/python-main-function/discussion/#t=33.93
Python programmers have come up with several conventions to define this startinghttps://realpython.com/courses/python-main-function/discussion/#t=36.3
point.https://realpython.com/courses/python-main-function/discussion/#t=40.56
00:41https://realpython.com/courses/python-main-function/discussion/#t=41.114
By the end of this tutorial,https://realpython.com/courses/python-main-function/discussion/#t=41.114
you’ll understand what this special __name__ variable is and how Python defines it,https://realpython.com/courses/python-main-function/discussion/#t=43.41
why you would want to use a main() function in Python,https://realpython.com/courses/python-main-function/discussion/#t=48.48
what conventions there are for defining main() in Python, and what the best practiceshttps://realpython.com/courses/python-main-function/discussion/#t=51.9
are for what code to put into your main() functions.https://realpython.com/courses/python-main-function/discussion/#t=57.18
01:01https://realpython.com/courses/python-main-function/discussion/#t=61.05
So, let’s get started.https://realpython.com/courses/python-main-function/discussion/#t=61.05
In some Python scripts,https://realpython.com/courses/python-main-function/discussion/#t=62.87
you may see a function definition and a conditional statement that looks likehttps://realpython.com/courses/python-main-function/discussion/#t=64.769
this.https://realpython.com/courses/python-main-function/discussion/#t=68.67
In this code, there is a function called main() that prints the phrasehttps://realpython.com/courses/python-main-function/discussion/#t=68.954
"Hello World!" when the Python interpreter executes it.https://realpython.com/courses/python-main-function/discussion/#t=72.93
01:16https://realpython.com/courses/python-main-function/discussion/#t=76.92
There is also a conditional, or if statement, that checks the value of __name__ andhttps://realpython.com/courses/python-main-function/discussion/#t=76.92
compares it to the string "__main__".https://realpython.com/courses/python-main-function/discussion/#t=81.66
01:24https://realpython.com/courses/python-main-function/discussion/#t=84.363
When thehttps://realpython.com/courses/python-main-function/discussion/#t=84.363
if statement evaluates to True, the Python interpreter executes main().https://realpython.com/courses/python-main-function/discussion/#t=84.84
If you want to learn more about conditional statements,https://realpython.com/courses/python-main-function/discussion/#t=89.43
then you can find more tutorials on the Real Python site—https://realpython.com/courses/python-main-function/discussion/#t=91.8
just enter “conditional statements” in the search box.https://realpython.com/courses/python-main-function/discussion/#t=95.49
01:39https://realpython.com/courses/python-main-function/discussion/#t=99.03
This code pattern is quite common in Python files that you want to be executedhttps://realpython.com/courses/python-main-function/discussion/#t=99.03
as a script or imported into another module.https://realpython.com/courses/python-main-function/discussion/#t=103.08
To help understand how this codehttps://realpython.com/courses/python-main-function/discussion/#t=105.953
will execute,https://realpython.com/courses/python-main-function/discussion/#t=108.06
you should first understand how the Python interpreter sets __name__, and that’shttps://realpython.com/courses/python-main-function/discussion/#t=109.17
what’s coming up in the next lesson,https://realpython.com/courses/python-main-function/discussion/#t=113.97
where you will see that it depends on how the code is being executed.https://realpython.com/courses/python-main-function/discussion/#t=115.83
Become a Memberhttps://realpython.com/account/join/
Overviewhttps://realpython.com/courses/python-main-function/
https://realpython.com/lessons/execution-modes-python/
Defining Main Functions in Python: Overview 02:01 https://realpython.com/videos/python-main-function-overview/
Execution Modes in Python 04:48 https://realpython.com/lessons/execution-modes-python/
Best Practices for Python Main Functions 11:17 https://realpython.com/lessons/best-practices-python-main-functions/
Defining Main Functions in Python (Quiz) 04:00 https://realpython.com/lessons/defining-main-functions-in-python-quiz/
Defining Main Functions in Python: Summary 00:49 https://realpython.com/lessons/defining-main-functions-python-summary/
Privacy Policyhttps://realpython.com/privacy-policy/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.