While we're talking about annoyances

BJörn Lindqvist bjourne at gmail.com
Sun Apr 29 07:34:36 EDT 2007


On 4/29/07, Steven D'Aprano <steve at remove.this.cybersource.com.au> wrote:
> To do that, I needed to generate an index table first. In the book
> "Numerical Recipes in Pascal" by William Press et al there is a procedure
> to generate an index table (46 lines of code) and one for a rank table
> (five lines).

51 lines total.

> In Python, my index function is four lines of code and my rank function is
> five lines. I then wrote three more functions for verifying that my index
> and rank tables were calculated correctly (17 more lines) and four more
> lines to call doctest, giving a total of 30 lines of code.

So 9 lines for Python, excluding tests.

> I also have 93 lines of documentation, including doctests, or three
> lines of documentation per line of code.

Then, without documentation, Python is roughly 560% (51/9) as
efficient as Pascal. But with documentation (assuming you need the
same amount of documentation for the Python code as the Pascal code),
(51 + 93)/(9 + 93) = 1.41 so only 141% as efficient as Pascal.

I wonder what that means? Maybe Python the language is approaching the
upper bound for how efficient an imperative programming language can
be? On the other hand, there seem to be some progress that could be
made to reduce the amount of work in writing documentation.
Documentation in Esperanto instead of English maybe?

-- 
mvh Björn



More information about the Python-list mailing list