comparation of Python with other languages

Alex Martelli aleax at aleax.it
Sun Jan 20 11:35:23 EST 2002


Sinule wrote:

> Hello I am a student and I am developing a project of image processing. I
> would like to see a comparation of a Python language with other languages
> (C++, Java..) in order to decide what interface use to develop my projetc.
> I have seen the Python home page comparation but it dont say any of speed
> or processing capacibility of language.

"Processing capability" is non-pareil.  Speed of purely Python-coded loops
in totally CPU-bound numeric operations, however, may not be good
enough for your needs -- that's why Python extensions exist, already coded
(typically in C, or C++) to give you top speed for typical low-level 
operations of such kinds, while letting you keep most of your program's
logic in Python for programmer-productivity.


> What is your opinion about if it is a good idea to develop my project with
> Python?

This depends on your project's details.  If your project can make good
use of existing Python extensions, such as PIL for image processing
and Numeric for computation on numeric arrays, then Python will allow
you non-pareil programming productivity: rations of 5 to 10 times the
productivity wrt Java or C++ are not unheard of, for programmers who
are experienced in both languages, and Python is also much easier to
learn and become experienced with than Java or (particularly) C++.

On the other hand, if you need to develop and run novel low-level
algorithms on large images, then C++ is probably the only language
that can give you the needed machine-performance, albeit at the
cost of horrid complexity and low programming productivity (you can
use C, or machine language, for more of the same; you can use some
functional-programming languages, such as OCaml, for high level
processing AND good performance, but if you don't already know any
FP, learning it will turn your mind inside out -- not a bad thing in terms
of instruction, but, how many months can you devote to the project?).

Ideal is probably to start with Python (and PIL, Numeric etc) with the
option of dropping down to C (or C++) if you identify processing speed
bottlenecks.  Often, 10% or so of your code can account for 90% of
the code's overall runtime: optimizing THAT 10% and leaving the rest
alone can give you both pretty good programming productivity AND
well-performing code as a result.  But, IS it acceptable, should the need
arise, for you to use TWO programming languages together for your
project?  It's most productive, but sometimes student-assignments
will not allow such mixing and matching.

If you can give us more details on your project ("image processing"
still covers a bit too much ground), we may be able to be more specific
in our advice.  Keep the discussion to this group, please (as opposed
to individual posters' mailboxes), so you get to hear many voices and
make up your own mind in the end!


Alex




More information about the Python-list mailing list