Python Speed Question and Opinion

Peter Hansen peter at engcorp.com
Fri Jun 4 23:32:15 EDT 2004


Maboroshi wrote:

> Hi I am fairly new to programming but not as such that I am a total beginner

Total beginners sometimes don't realize that questions such as yours
have been asked repeatedly, many times, in the past.  Searching Google
Groups (http://groups.google.com) for such discussions in this newsgroup
will save yourself and others much time rehashing the argument all
over again.  (And it does generally become an argument, after the
initial factual responses. :-)

> From what I understand C and C++ are faster languages than Python. Is this
> because of Pythons ability to operate on almost any operating system? 

True, they are often faster, but not always.  The reason is simply that
Python (at least, the C implementation of Python) is an interpreted
language, whereas C/C++ are compiled to native machine code.

> Please don't take this the wrong way I am totally one for standards. I am
> just looking at these forums and there is a lot of stuff about Python and it
> inability to match C or C++

Some people are inappropriately obsessed with speed and think that just
because C can provide better performance for certain types of problem,
it must therefore be a better language for all purposes.  Other people
think that speed of *development* is far more important, and choose
Python even for those applications where it is slower.  Often, perhaps
surprisingly, they find it can run at quite acceptable speeds, and
in some cases even faster than what they could get from C with a
similar amount of development time invested.

> Also from what I understand there are Interpreted and Compiled languages
> with Interpreted languages memory is used at runtime and Compiled languages
> the program is stored in memory.
> 
> Or is this wrong?

I can't say if it's wrong because it's very befuddled.... doesn't
mean anything to me.  With both types of languages the program is
"stored in memory" and with both types "memory is used at runtime".

Stop worrying about performance and interpreted vs. compiled.
Try Python, use it for more and more stuff if you like it, less
stuff or nothing at all if you don't, and focus on writing good
quality code, not the fastest code you can write...

-Peter



More information about the Python-list mailing list