source code size metric: Python and modern C++

Pavel Vozenilek pavel_vozenilek at yahoo.co.uk
Mon Dec 2 17:51:58 EST 2002


tanzer at swing.co.at (Christian Tanzer) wrote in message news:<mailman.1038820143.9622.python-list at python.org>...
> pavel vozenilek at yahoo.co.uk (Pavel Vozenilek) wrote:
> 
> 
> Class libraries don't change the picture (the most an existing C++
> class library can do for you is change the offset).
> 
> IMHO, the biggest difference between C++ and Python is boilerplate. In
> Python, you can add mechanisms like persistence, introspection, etc.
[snip]

Thanks for the answer.

I'll try to summarize the code size differences I see (I know C++ and
am learning Python so take it as naive attempt):

1) missing brackets and semicolons in Python,
2) missing type declarations in Python,
3) missing headers with class declarations in Python,
4) missing advanced data structures and lambda in C++,
5) persistence and introspection present in Python,
6) something else I don't see.

I'll avoid (1), (2) and (3). 

In (4) C++ got better recently and some contructs can be expressed as
succintly as Python does. In other message in this thread I talk about
it.

(5) is real problem. Crude form of persistence can be done (and is
discussed on Boost), hacking in introspection is sort of possible but
really inpractical, AFAIK.

What I am most curious is what (if) can be (6) and how important
factor for code size it is compared to (4) and to (5).

I feel currently is that (4) was the biggest differentiator (and its
really only feeling of beginner, so I ask).

/Pavel



More information about the Python-list mailing list