[Christian Tismer Mon, Jan 20, 2003 at 03:27:31AM +0100]
Running the following command over the current Python CVS src/dist direcotry:
wc $(find . -name '*.c' -or -name '*.h')
gives this result today (Januaray 20, 2003, 2:31 (GMT+01.00)
319282 1132750 9397985 total
Ok, this is about everything in the core distribution, may it be needed for Minimal Python (whatever it is) or not. Let's roughly shrink it down to 150.000 lines.
I am not sure what this number (300.000) really means at all. For example, 100.000 lines of it are in the Modules directory (not counting their .h files). And getting a running Python-Python-Interpreter doesn't require rewriting all C-stuff.
Now, think of code like ceval.c which is alone 3900 lines of code, and not the most simple code.
If this wouldn't translate to less than 1000 lines of nice python code i would be surprised.
Of course, we can create a serious new interpreter, with all "borrowed" objects wrapped in a proper way quite quickly, and I still think this is a good idea.
good :-)
But I think we can do much better. And most probably, people will not get bored to do the implementation, see part three.
Part Two: Making you frightened about the C code ------------------------------------------------
No offense to the python-dev people (also, since I do belong to this group a little bit), the C code base is absolutely great. As a code base written in C, of course.
But I would like to encourage everybody to pick some medium-sized C source file and try to translate it into Python. It is possible, and it isn't too difficult. But it makes you stumble and stumble and stumble.
btw, I would think there is two orders of magnitude more python code out there than python C-extensions.
[more analysis of how much good C-code there is]
Part Three: Proposing A Radical Consequence -------------------------------------------
I see no point in wasting manjears of coding to re-invent the whell by assembling piece-to-piece from C code to Python code. For sure, there are some very relevant modules which might need to be hand-coded. But, and this is driven by the summary of what I thought to re-code by hand today: I believe that it is possible to automate this translation process! We can set up some default mappings for the most frequent C constructs. There are a number of free-ware C compilers around, and also some C interpreters. My vision since today is now to augment such a compiler to become a Python extension, and then run this compiler over all the C code. The Python extension should then try to provide a re-write of the C code in Python! ... That's what I'm saying today: Make the move from C to Python automatic, by 95 percent.
Now *this* seems a like a huge undertaking which requires to deal with C-parsers for starters. Don't take me wrong but i don't believe in this route, yet. But i will do as you say and spent more time recoding some stuff in python and try getting it to work. Maybe you are right. cheers, holger