LOC in Python and C++ in large projects

Terry Hancock hancock at anansispaceworks.com
Fri Jul 1 15:29:14 EDT 2005


On Friday 01 July 2005 07:55 am, Adriaan Renting wrote:
> I think it would be interesting if any readers with more experience as I
> have would comment on how Python behaves in large projects, and how much
> less lines they need compared to C++ or Java.
> I have worked on several C++ projects with a few million lines of code,
> I would appreciate experience with comparable projects. (can you do it
> in 10.000 Lines of Python?)

Well, Zope 2.7.0 is (about) 158,046 LOC by a simple wc (with full-line
comments and blank lines stripped). 

Zope X3 is 175,818 LOC by the same wc method.*

I am only counting the Python code, BTW, not the C extension modules.

The thing that's coming into my mind, is what on Earth would require
"a few million lines of code" in Python?  And also, what would be comparable
to Zope, written in C++?

OTOH, Zope uses a number of techniques that  trump your "C++
advantages" such as their own "interfaces" module which is probably
superior to "static type checking" as a means of maintaining communications
between programmers (even 3rd party programmers, which is very
important on an open source project).  Of course, you could argue that
"static type checking" and "interfaces" are very similar, but I think the
latter is a bit smarter, at least in Python using Zope3's interface module.

So, in a sense, I agree with you that such tools help keep code manageable,
but disagree that Python doesn't have them.

*Which is just this:
.../Zope-2.7.0/lib/python> find . -name "*.py" -exec grep -v -e "^#" {} \; | grep -v -e '^$' | wc
 158046  591237 6312725

.../ZopeX3/lib/python> find . -name "*.py" -exec grep -v -e "^#" {} \; | grep -v -e '^$' | wc
 175818  642486 7023206

I'm sure there are holes in this method, but it ought to give a rough count.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list