[Tutor] Does python produces bytecode??

Kent Johnson kent37 at tds.net
Fri Jan 5 18:15:44 CET 2007

Asrarahmed Kadri wrote:
> Hi Folks,
> Just a bit curious about how python runs the program?
> I do know that it does not compile the code; its an interpreted language.
> Do we have something like Python virtual machine ??
> Please hlep me to understand these things.

Yes, Python has a bytecode compiler and a virtual machine (bytecode 
interpreter). The compiler is invoked automatically when needed so it is 
not really apparent to a casual user.

The dis module in the standard library lets you see the bytecode 
representation of a function or other code. The docs for this module 
include a listing of all the bytecode instructions.

If you want to dig into the details you have to look at the C source 
code for Python. This page gives a high-level guide:


More information about the Tutor mailing list