title: How to properly finish a python 3 script
body: <p>In C++, the <code>main()</code> function is standardized to be of type <code>int</code>, and thus should <code>return(0)</code> with successful execution. Also, programs will typically print one line feed at the end to flush <code>stdout</code>, like so:</p>
  
  <p><strong>MINIMAL, COMPLETE, VERIFIABLE EXAMPLE</strong></p>
  
  <p><strong>hello_world.cpp</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  int main() {
      std::cout &lt;&lt; "hello, world" &lt;&lt; std::endl;
  
      printf("\n");
      return(0);
  }
  </code></pre>
  
  <p><em>hello, world</em></p>
  
  <p>Is there an equivalent way to properly exit a Python script? Does it make sense to also print a line feed, and then explicitly exit with code 0?</p>
  
  <p><strong>hello_world.py</strong></p>
  
  <pre><code>import sys
  print("hello, world")
  
  print('\n')
  sys.exit(0)
  </code></pre>
  
  <p><em>hello, world</em></p>
  
  <p>Tyvm :^)</p>