Why does Python compile modules but not the script being run?
<p>Why does Python compile libraries that are used in a script, but not the script being called itself?</p>

<p>For instance,</p>

<p>If there is <code>main.py</code> and <code>module.py</code>, and Python is run by doing <code>python main.py</code>, there will be a compiled file <code>module.pyc</code> but not one for main.  Why?</p>

<p><strong>Edit</strong></p>

<p>Adding bounty. I don't think this has been properly answered.</p>

<ol>
<li><p>If the response is potential disk permissions for the directory of <code>main.py</code>, why does Python compile modules? They are just as likely (if not more likely) to appear in a location where the user does not have write access. Python could compile <code>main</code> if it is writable, or alternatively in another directory.</p></li>
<li><p>If the reason is that benefits will be minimal, consider the situation when the script will be used a large number of times (such as in a CGI application). </p></li>
</ol>
