Python Written in C?

Terry Reedy tjreedy at udel.edu
Tue Jul 22 00:04:45 CEST 2008



mk wrote:

> Seriously, though, would there be any advantage in re-implementing 
> Python in e.g. C++?

Considered and rejected by Guido and the CPython developer crew.
Anyone who wants C++Python is free to make one, just as people have done 
JavePython (Jython), C#Python, (IonPython), PythonPython (PyPy), and 
compiled-CPython (multiple).

> Not that current implementation is bad, anything but, but if you're not 
> careful, the fact that lists are implemented as C arrays can bite your 
> rear from time to time (it recently bit mine while using lxml). Suppose 
> C++ re-implementation used some other data structure (like linked list, 
> possibly with twists like having an array containing pointers to 1st 
> linked list elements to speed lookups up), which would be a bit slower 
> on average perhaps, but it would behave better re deletion?

This is a data structure issue, not a language issue.  The tradeoffs for 
practical implementation include code-length, code-complexity, 
code-fragility, and ease of cross-platform compilation as well as 
classical time and space issues.

tjr




More information about the Python-list mailing list