Defining main() in python
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/419163/what-does-if-name-main-do">What does &lt;if <strong>name</strong>==&ldquo;<strong>main</strong>&rdquo;:&gt; do?</a>  </p>
</blockquote>



<p>Often, I see the following code in python programs</p>

<pre><code>if __name__ == '__main__':
main()
</code></pre>

<p>I'm following the <a href="http://code.google.com/edu/languages/google-python-class/introduction.html" rel="nofollow">Python Class</a> on Google code, and it says that it's standard boilerplate code.</p>

<p>Do I really need to write such code in all my scripts?</p>

<p>What functionality would this add to my programs?</p>
