Best way to learn Python?

Peter Hansen peter at engcorp.com
Sat Sep 29 00:00:23 EDT 2001


Thomas Strathmann wrote:
> 
> Still sticking with C for the most part of system programming 
> (hell, you don't really want to program an assembler or compiler 
> in a scripting language, do you? - although I have to admit that 
> the idea is pretty tempting...) 

I don't see a real problem with that.  The *only* drawback is
compilation speed, and that's hardly going to be a serious issue
with modern computers.

(Cue anecdote demonstrating long experience which others will,
however, doubtless easily be able to top. :)

A few years after I learned C, I was compiling programs with
a few dozen modules on an early PC.  The compilation (MS C early
version... 3.0?) would take upwards of twenty minutes if I recall
correctly.  A compiler written in Python running on a modern
computer would take much less time to compile the same program.
In fact, much of the work would be parsing, manipulation of 
structures in memory, and string processing, and I strongly 
suspect much of this work would be done in the C routines 
on which Python is built, rather than in pure Python code.
(Please compiler experts correct my pathetic assumptions if
they're badly off-base. :)

Chances are good that a compiler written in Python would be 
less buggy, and would quickly acquire more highly optimized
algorithms, and would be more maintainable and thus advance
faster in general, than the same compiler written in C.
Had I ever encountered source for a compiler written in 
Python, I might well understand compiler construction more 
than I do now (which is to say, very little).

Performance is not the primary concern any more, and
probably never really was.

> > But if you think you should start with C before learning
> > Python, then you'd better back up a little and learn
> > assembly language before C.  No, wait!  We should all
> > learn how to write _microcode_ for CPUs before we learn
> > assembly...
> 
> That's actually not a bad idea at all IMHO. ;-) 

Well, no more so than requiring drivers to learn metallurgy so
they understand more about their engines so they know how their
cars work...  That is to say it is *not* a generally good idea,
IMHO.  But it might be okay for individual cases.

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list