Does a python code with the function exec in it get compiled to an executable?
<p>I am new to python and I have never compiled python code to an executable file before. The languages I am well familiar with are C, C++, and Java and I have never come across a language that lets you modify the code from within itself, like Python which uses has the method <code>exec</code>.  </p>

<p>For the following code,</p>

<pre><code>a = 500
code  = raw_input() 
exec (code)
</code></pre>

<p>When I give the input as, <code>print (a)</code> the program displays the value in <code>a</code>. <strong>So this means the variable <code>a</code> comes within the scope of the code</strong>. </p>

<p>I don't understand what would happen if we try to convert the python code to an executable using a program like <code>py2exe</code>. <strong>Will the method <code>exec</code> still work? If it does work, does <code>py2exe</code> bring the entire Python compiler and interpreter with it when the program gets compiled?</strong></p>