New Python User Question about Python.
aahz at panix.com
Sat Aug 25 18:19:32 CEST 2001
In article <20010822215737.01525.00001013 at mb-cv.aol.com>,
Deep0258 <deep0258 at aol.com> wrote:
>I am just wondering, since I am now joining python and it's greatness,
>why don't the developers of Python make Python just as fast(if not
>faster) than the older, more low-level lanquage. Yes, there are
>advantages using the interpreter style programs, but isn't there a way
>to incorporate the speed of compiled programs with the debugging and
>clearness of Interpreter to make Python a much faster lanquage. There
>might be a way, but I'm pretty new so I don't know. Any answers, thank
>you for listening?
Let me introduce another issue into this thread: one of the goals of
Python is to get out of the programmer's way so that zie can focus on
the program. Let's say that Python is ten times slower than C or C++
(which is about right for "typical" code). Now let's suppose that
Python lets you write code about twice as fast as C/C++, and that the
typical Python program doing the same work is about one-third as long
(also good assumptions for "typical" code).
This means that you can write six working Python programs in the time it
takes to write one working C/C++ program. Or you could write the same
program six times, getting a better algorithm on each iteration. If
your C/C++ program exhibits O(NlogN) behavior and your Python program
exhibits O(N) behavior, your Python program is likely to beat the C/C++
program over the long haul.
Python can *absolutely* be faster than C/C++.
Let's take another example, near to my specific expertise: suppose you
want to write a fast web spider. Writing it in C/C++ is going to be a
pain, because the only way to get a fast spider is to parallelize the
I/O, which means either mucking around with RPC or threads in C/C++. Do
you really want that pain? OTOH, threads are *easy* in Python....
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
"I now regard a fact as a hypothesis that people don't bother to argue
about anymore." --John Burn, quoted in Lawrence Wright's _Twins_
More information about the Python-list