Why is python not written in C++ ?

Stephen Hansen me+list/python at ixokai.io
Sun Aug 1 19:52:19 EDT 2010


On 8/1/10 4:08 PM, 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?

Portability if nothing else has been a strong reason to keep the Python
implementation to standard C. Its not as bad as it used to be, but
there's still quite a few differences between various C++ compilers.
Even with the officially supported platforms shrinking of late, and talk
of including some C++ in an isolated part of the CPython implementation
(the UnladenSwallow JIT is C++, IIRC), rewriting the whole thing in C++
seems like a major waste of time.

If you went and used the OO-features of C++, but then you run into a
problem: Python's OO design is strikingly different from C++'s. There's
no enforced encapsulation (on purpose), just as one example.

That's not saying you -couldn't- match Python's OO design on top of C++,
after all-- they've done it in Java, which has a hardcore interpretation
of OOP. But what does that get you over the current status quo? C's
leaner and meaner then C++.

> 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.

Wny would this be more suitable? The Python idea of Object Orientedness
doesn't line up with the C++ own *on purpose*, so why adopt one idea and
design of OOP to implement a different one?

> Has it ever been planned to rewrite in C++ the historical implementation
> (of course in an object oriented design) ?

Have you actually looked at the "historical implementation"? It's
actually quite object oriented. You don't have to have an object
oriented language to use OO design.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20100801/43e51706/attachment-0001.sig>


More information about the Python-list mailing list