title: Compile time checking and where is the main script byte-code is stored in Python?
body: <p>I'm new to the Python and following multiple online tutorials to learn. One of it is <a href="https://developers.google.com/edu/python" rel="nofollow noreferrer">Google for Education</a>.</p>
  
  <p>In the <a href="https://developers.google.com/edu/python/introduction" rel="nofollow noreferrer">Google's tutorial</a> there is a section:</p>
  
  <blockquote>
    <p><strong>Code Checked at Runtime</strong> </p>
    
    <p>Python does very little checking at compile time, deferring almost all
    type, name, etc. checks on each line until that line runs. Suppose the
    above main() calls repeat() like this:</p>
  
  <pre><code>def main():
  if name == 'Guido':
      print repeeeet(name) + '!!!'
  else:
      print repeat(name)
  </code></pre>
    
    <p>The if-statement contains an obvious error, where the repeat() function is accidentally typed in as repeeeet().
    The funny thing in Python ... this code compiles and runs fine so long
    as the name at runtime is not 'Guido'. Only when a run actually tries
    to execute the repeeeet() will it notice that there is no such
    function and raise an error. This just means that when you first run a
    Python program, some of the first errors you see will be simple typos
    like this. This is one area where languages with a more verbose type
    system, like Java, have an advantage ... they can catch such errors at
    compile time (but of course you have to maintain all that type
    information ... it's a tradeoff).</p>
  </blockquote>
  
  <p>There is a good example of runtime check in that section but no compile time check example.</p>
  
  <p>And I'm interested in knowing about that <strong>little checking at compile time</strong>.</p>
  
  <p>I can't find anything in the internet regarding that line. Every possible search returns about compiling python scripts and modules like <a href="https://stackoverflow.com/questions/2998215/if-python-is-interpreted-what-are-pyc-files?rq=1">this</a>, <a href="https://stackoverflow.com/questions/3878479/why-are-main-runnable-python-scripts-not-compiled-to-pyc-files-like-modules">this</a> and <a href="https://stackoverflow.com/questions/5268017/why-does-python-compile-modules-but-not-the-script-being-run">this</a>.</p>
  
  <hr>
  
  <p><strong>Edit:</strong></p>
  
  <p><code>python myscript.py</code> is compiled(otherwise we wont be getting errors) and then interpreted to execute. Then compilation process should definitely produce a code(it might be byte-code). Is that code stored in memory instead of storing it as <code>.pyc</code> in the filesystem?</p>
  
  <hr>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>For more on why the main script byte code is stored in memory and why modules are compiled can be found <a href="https://stackoverflow.com/questions/471191/why-compile-python-code">here</a>.</p>