Why is python not written in C++ ?

Roy Smith roy at panix.com
Sun Aug 1 20:36:20 EDT 2010


In article <4c55fe82$0$9111$426a34cc at news.free.fr>,
 candide <candide at free.invalid> wrote:

> Python is an object oriented langage (OOL). The Python main 
> implementation is written in pure and "old" C90. Is it for historical 
> reasons?
> 
> C is not an OOL and C++ strongly is. I wonder if it wouldn't be more 
> suitable to implement an OOL with another one.

One thing that comes to mind is that it's much easier to distribute C 
libraries than C++ libraries.

If I compile a main program with one C compiler and you compile a 
dynamically loaded library with another C compiler on the same box, the 
odds are pretty good they'll interoperate without any problems.

Not at all so with C++ compilers.  The linkage is *way* more 
complicated.  Not just how the two compilers do name mangling, but how 
they handle exceptions, RVO, and a zillion other details.  Pretty much 
the only way to make it work is to compile everything with exactly the 
same compiler.  That would make it pretty close to impossible for people 
to take a Python core distribution and add their own extension modules 
to it.



More information about the Python-list mailing list