Is this a true statement: Part II

Kragen Sitaker kragen at
Sun Jul 1 07:17:31 EDT 2001

In article <mailman.993843346.4433.python-list at>,
Paul Prescod  <paulp at> wrote:
>MDK wrote:
>> 1. Excluding writing device drivers the answer is a clear yes.
>Here's how I would summarize it. Programs have three main parts: getting
>data (including user events) into the program, doing computation on it,
>and getting data out of the program (including user feedback).
>All proper programming language are equivalent on the "doing
>computation" part.

Well, they're equivalent in the theoretical sense that what you can
express in one, you can express in another.  But there are some major
practical differences:
* some languages are much easier to express some computations in; Python is
  much easier than C++ or C to express almost any computation in.  This
  is a topic one could write about for pages upon pages, but the
  difference is a matter of small factors: typically 5 to 20.
* different languages have different implementations; the same
  computation running on different implementations (of the same
  language or of different languages) can use vastly different
  quantities of memory and CPU time.  Factors of 20 to 100 in CPU time
  usage are commonplace; factors of 100,000 in CPU time usage are not
  unheard of.  Likewise, factors of 10 in memory usage are commonplace,
  and factors of 100 in memory usage are not unheard of.

In particular, Python programs tend to be between 10 and 1000 times as
slow as equivalent programs written in C, use between 1 and 20 times as
much RAM as the C version, take about 1/10 the programming time as the
C version, and contain about 1/10 the bugs of the C version does.

Given these tradeoffs, people tend to implement simpler programs in C
than in Python when faced with the same problem, which often results in
solving the problem less efficiently.

>But the input and output parts depend on the environment that the
>program is runing in.


>You could write an operating system that could only be directly
>programmed in Python.

I'm not sure how.  Nobody has yet come up with an operating system that
could only be directly programmed in C, or Lisp, or Algol, or Java,
despite implementing operating systems in all four.  I think some of
the Burroughs machines required special god privileges to run the
assembler, but there was still an assembler.
<kragen at>       Kragen Sitaker     <>
Perilous to all of us are the devices of an art deeper than we possess
       -- Gandalf the White [J.R.R. Tolkien, "The Two Towers", Bk 3, Ch. XI]

More information about the Python-list mailing list