[Tutor] bytecode primer, and avoiding a monster download

Alan Gauld alan.gauld at btinternet.com
Tue May 28 01:20:21 CEST 2013


On 27/05/13 21:21, Jim Mooney wrote:
> Oscar Benjamin <oscar.j.benjamin at gmail.com>
>
>> What do you want these for? I've never needed to know what the
>> interpreter's bytecodes are.
>
> I programmed A86 Assembler years ago, and just find the bytecode has a
> comfortable clarity as a learning tool,

To me, the bytecodes are the literal hex values corresponding
to the Python "assembler" statements. Are you sure you need the 
bytecodes? You can use the standard library to generate the
assembler listing from the Python code. Like Oscar I'm not sure
how the bytecodes would help?

I'm an ex assembler hacker myself but I've never found a need
for the Python bytecodes. Its not like you ever need to translate
the binary into assembler (the usual reason for reading bytecodes) since 
you usually have the source and from that you can get the dis-assembly 
listing. If you don't have the source it probably
means it's a C module and you need to look at the native machine
code disassembly not the Python one.

Can you give a use case of how you think you could use them?
There may be another way to do what you want.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list