Why is python not written in C++ ?

Carl Banks pavlovevidence at gmail.com
Mon Aug 9 14:08:16 EDT 2010


On Aug 9, 6:39 am, Ulrich Eckhardt <eckha... at satorlaser.com> wrote:
> candide wrote:
> > Python is an object oriented langage (OOL). The Python main
> > implementation is written in pure and "old" C90. Is it for historical
> > reasons?
>
> The fact that Python is OOP doesn't mean that the implementation of it has
> to be written using an OOP language.
>
> Other than that, I'm actually surprised that nobody mentioned that Python
> actually _is_ written in C++. Yes, it's restricted to a subset thereof that
> is compatible to C, but you could also claim that it was written in a
> subset of C compatible to C++.
>
> :)

I highly doubt the Python source would build with a C++ compiler.

C++ is "'mostly' 'backwards' compatible" with C insofar as you can
pretty easily write C code that is also legal (and semantically
equivalent) C++.  But if you don't actively try to write code that is
compatible with both languages, chances are the C code will invoke one
of those "'minor' 'backwards' incompatibilies", the most common one
being failure to cast a pointer.


Carl Banks



More information about the Python-list mailing list