title: Why use def main()?
body: <p>I've seen some code samples and tutorials that use</p>
  
  <pre><code>def main():
      # my code here
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>But why? Is there any reason not do define your functions at the top of the file, then just write code under it? ie</p>
  
  <pre><code>def my_function()
      # my code here
  
  def my_function_two()
      # my code here
  
  # some code
  # call function
  # print(something)
  </code></pre>
  
  <p>I just wonder if there is any rhyme to the main?</p>