translating Python to Assembler

Grant Edwards grante at visi.com
Mon Jan 28 12:15:31 EST 2008


>> The script is essentially gone. I'd like to know how to read
>> the pyc files, but that's getting away from my point that
>> there is a link between python scripts and assembler. At this
>> point, I admit the code above is NOT assembler, but sooner or
>> later it will be converted to machine code by the interpreter

No it won't.  In any of the "normal" implementations, bytecodes
are not converted to machine code by the interpreter.  Rather,
the interpreter simulates a machine that runs the byte codes. 

>> and the OS and that can be disassembled as assembler.

No it can't.  The result of feeding bytecodes to the VM isn't
output of machine code.  It's changes in state of _data_
structures that are independate of the processor's instruction
set.

> Yes. But the interpreter doesn't convert the entire file to machine
> language. It reads one instruction after another and, amongst other
> things, outputs corresponding machine code which "does" what's
> intended by the byte code instruction.

No, it doesn't output corresponding machine code (that's what
some Java JIT implementations do, but I'm not aware of any
Python implementations that do that).  The virtual machine
interpreter just does the action specified by the bytecode.

-- 
Grant Edwards                   grante             Yow! Nipples, dimples,
                                  at               knuckles, NICKLES,
                               visi.com            wrinkles, pimples!!



More information about the Python-list mailing list