[Tutor] bytecode primer, and avoiding a monster download

Alan Gauld alan.gauld at btinternet.com
Wed May 29 01:27:20 CEST 2013


On 28/05/13 21:15, Jim Mooney wrote:

> I think authors miss a didactic opportunity by not using bytecode as a
> teaching tool now and then, since it's easily explained, at least for
> basic statements.

Assuming you mean the assembler statements then it may be true.
Looking at Bytecode is just an exercise in pain for first year 
programming students... or a way to reverse engineer a binary
file for which you don't have source :-(

> I guess it has to do with sales. If someone new to any programming
> opens a Python book to buy and sees all these prettily laid-out Python
> statements that look almost like natural language, only more ordered,
> but then sees a page of bytecode, they'd probably drop the book  and
> run ;')

It's not just sales, it's more that the majority of programmers 
(including professionals) simply have no idea how a computer does things 
internally. They don't think about programs that way they think of them 
in terms of the abstract calculation engine that a computer pretends to 
be. Seeing assembler would not help them at all. But if someone has any 
appreciation of the computer architecture, how CPU and memory are 
related then yes, assembler can clarify some things.

But, especially in a language like Python, too much awareness of how the 
language works at the machine level can be counter productive because 
you start programming for the machine. And that's dangerous because the 
mechanisms are liable to change in a future version and your code stops 
doing what you think it does. Occasionally it is necessary but I've been 
using Python more or less exclusively for
the last 12 years and I've only twice had to delve into the assembler
(and maybe another 5 or 6 times out of curiosity).

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



More information about the Tutor mailing list