variable declaration

Fredrik Lundh fredrik at pythonware.com
Tue Feb 8 04:06:58 EST 2005


Terry Reedy wrote:

>>At compile time (by which I mean when the Python bytecode is built)
>
> Compile time is when the def statement is executed

no, that's run time.  "def" is an executable statement, just like "print", "for",
assignments, "import", etc.

the entire module is compiled (to bytecode) before any part of it is executed.
the compiler handles "global" and "from __future__", everything else is done
at runtime.

</F> 






More information about the Python-list mailing list