C++ bad-mouthing (was: Why learn Python ??)

John J. Lee jjl at pobox.com
Tue Jan 13 12:44:36 EST 2004


"Donn Cave" <donn at drizzle.com> writes:

> Quoth Paul Rubin <http://phr.cx@NOSPAM.invalid>:
> ...
> | The one attempt I know of to write a substantial Python application
> | competitive with similar applications written in C was the Grail web
> | browser, and AFAIK that was a complete failure.  However, for small to
> | medium sized projects which don't have to run fast, Python is great.
[...]
> But at any rate, I thought we were talking about huge projects
> involving many programmers, and I don't think Grail was of that
> sort at all.

Right.  Wasn't it a research project?  In any case, hardly a
large-scale programming effort along the lines of Mozilla!


> I don't know what kind of programmer resources were
> allocated to it,

No obvious attribution other than "CNRI" in the tarball, but I think
mostly Guido.  :-)


> but I bet it was actually a smashing success in
> those terms.  As for its size, I'd have to look, I have the code
> around somewhere, but I'd guess it was smaller than Mailman or Zope.
> Small enough that one programmer could become pretty thoroughly
> acquainted with the whole thing.

john[0]$ find /usr/local/src/python/grail-0.6 -name '*.py' | xargs /home/john/bin/pycount.py
   lines    code     doc comment   blank  file
[...]
   34808   25255    2801    2356    4396  total

pycount reports 108756 code lines for Zope 2.6.3 (watch out: for some
reason pycount spits out more than one total line with Zope, which you
then have to add up -- maybe I'm doing something wrong there...).
Given typical reported ratios of Python to C++ lines of code, that's a
lot of code (not to mention all the Zope Python code outside of that
package -- plone, for example; there's a fair amount of C code there,
too, of course).  Alex Martelli claimed a C++/Python lines of code per
function point ratio of 5 or 6 in a post in this group -- if you
believe that's a fair rule of thumb, then on that basis you'd expect
550-650 kLoC for a mythical Zope-in-C++ .  In reality, since Zope
takes advantage of Python's features, you'd expect to have to write
many more lines of C++ than that, following Greenspun's tenth law.

Who can be sure what the biggest Python code is, though?  See Paul
Graham's article on his web store-builder (implemented in Lisp) for
one motivation for keeping it a secret (a motivation of the order of
several tens of millions of dollars, IIRC ;-).

http://www.paulgraham.com/avg.html


(pycount reports 21730 code lines for mailman 2.1.4, BTW)


John



More information about the Python-list mailing list