Python any good?
tottinge at indy.rr.com
Mon Feb 17 21:33:19 CET 2003
N D Efford wrote:
> Glen <lpepicel at nycap.rr.com> wrote:
>>In fact the only downside to python is that not many people use python!
> A lot of people use it: enough for O'Reilly to have published seven
> Python books, anyway - eight if you count the one on Jython.
> But if you mean that Python has lived in the shadow of languages like
> Perl for a long while, I wouldn't disagree with you.
> However, that is changing. Companies like Industrial Light & Magic
> and Google are coming clean about the importance of Python to
> their work; a number of computer games developers are turning to
> Python to write the scripting and high-level code for their products;
> etc etc...
>>Also, Python is not fast. It is meant to be a high level language for
>>non-speed critical applications and scripts.
> True. The language developers have always held qualities such
> elegance, clarity and ease of maintenance of code in higher
> esteem than sheer performance.
"Not fast" is always one of those terms that I worry about.
Is python "not fast" becuse it uses a virtual machine? Let's not wind up
the Java, Smalltalk, etc. guys here and have that discussion. Or lets,
and see what conclusions we have.
Is it "not fast" because it has GC? Let's wind up the Java, Smalltalk,
Ruby, and the C++ GC guys on that one and let them roll. Having GC and
an interpreter doesn't mean that adding numbers will take 1/20ths of
Certainly there are ways to do things that are not fast. The guys who
work on the core are always finding more efficient ways to do things,
and writing them into the interpreter (why is smalltalk so fast? Same
reason -- the environment becomes faster). A lot of performance talk on
the python ngs is correcting naively slow ways of doing things.
What do you need to go fast? It has a profiler which works quite well.
I found that I'd once written a python program that was clearly not fast
(not fast enough), ran the profiler, and then fixed the stupid mistake I
made. I had a huge loop hidden in a function, and it had a huge
temporary data structure. Duh. And that function was being called on
almost every string that I outputted -- Double-duh. It should have been
obvious, but I was concentrating on getting the desired effect. That's
how those things are. I fixed it in about 5 minutes, and the code was
quite peppy from then on.
Need more than that? there are little boosters like psycho which can
speed things up, and the Parrot guys claim now that they will run Python
faster than Python can. I'm not sure where PyInline is right now, but
that was supposed to make it easy to run modules written in other
Okay, the problem is partly that interpreters are very
democratic/altruistic, doing the greatest good for the greatest number.
You may have special problems that need special measures. Then you have
the old standbys like Boost and SWIG and the other ways to extend the
interpreter with C or C++.
How fast is fast? What does it take for a language to be considered
fast? Is C++ ever "not fast"?
I just don't want the world thinking that any program written in python
will be too slow for production use. I think that if you look at the
applications in the world that use python, you'll be surprized at how
amazingly well they perform.
Besides, if you have a database, you seldom have to optimize code --
it's almost always the data storage and I/O. <wink> By the way, python
does I/O better all the time, too.
More information about the Python-list