Why is python not written in C++ ?

Christian Heimes lists at cheimes.de
Mon Aug 2 03:20:15 CEST 2010

Am 02.08.2010 01:08, schrieb candide:
> Python is an object oriented langage (OOL). The Python main 
> implementation is written in pure and "old" C90. Is it for historical 
> reasons?

Python is written in C89 to support as many platforms as possible. We
deliberately don't use any new features and almost no compiler specific
extensions to make the interpreter portable. AFAIK the only compiler
specific feature used in Python are computed gotos and they are optional.

> 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.
> Has it ever been planned to rewrite in C++ the historical implementation 
> (of course in an object oriented design) ?

I like to say that the Python interpreter is written in object oriented
C code. Every Python object evolved around PyObject and PyType structs
that are extended (subclassed) to add additional members. Python won't
gain anything useful from a pure C++ implementation. C++ would only add
a major layer of complexity and scary features.

In your opinion what would Python gain from a C++ implementation?


More information about the Python-list mailing list