Is python very slow compared to C

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sun Feb 12 10:11:05 EST 2006


On Sun, 12 Feb 2006 06:20:10 -0800, bonono wrote:

> 
> Steven D'Aprano wrote:
>> But, in general, more often than not, Python is fast enough. The extra
>> value of using something like Lua or Ocaml or even C is just not enough to
>> make up for the disadvantages of using those languages.
>>
> What is the disavantage of Lua comparing with Python ? Or Ocaml
> comparing with Python ?

If your developer gets hit by a bus, you won't easily find a replacement.
This may not be a factor if you are programming for pleasure, but in the
commercial world of software development, availability of skilled
programmers is absolutely critical for the use of a language.

I realise that neither Lua nor Ocaml are entirely unknowns, both have been
used commercially, but I believe Python developers are more widely
available.

Google "python programming": 19,000,000 hits.
Google "lua programming": 574,000 hits.
Google "ocaml programming": 325,000 hits.

That will give you a rough estimate for the amount of resources out there
on the web for each language. By comparison, even Forth gives 13 million
plus hits, and who uses Forth?

Another rough measure of the availability of resources is the Dummies test:

Google "python for dummies": 323,000 hits.
Google "lua for dummies": 46,400 hits.
Google "ocaml for dummies": 693 hits.

Only Python For Dummies is an actual dead-tree book. I think it is safe to
conclude that Lua and Ocaml offer far fewer resources for somebody looking
to learn the language than does Python.

Lua appears to be *too* lightweight, without even classes or inheritance,
and a single data type where Python has dicts, sets, tuples and lists.

Ocaml seems to use more punctuation than I'm comfortable with (lots of
double semi-colons and -> symbols), but Python seems to be moving along
those lines too with list and generator comprehensions, and none of us
really want to return to Cobol's verbose arithmetic.

Wikipedia says "However, [Ocaml] also forces the programmer to conform to
the constraints of the type system, which can require careful thought and
close attention. ... effective use of OCaml's type system can require some
sophistication on the part of the programmer." That suggests that writing
Ocaml code may be more difficult than writing Python code. Wikipedia also
emphasises how hard it is for the compiler to generate good quality
machine code from Ocaml, which suggests that perhaps the compilation stage
could be slow.


-- 
Steven.




More information about the Python-list mailing list