From: candide on
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.

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

From: Terry Reedy on
On 8/1/2010 7: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?

Python was first released before C++. C is available on, and hence
Python runs on, systems that do not have C++ available.

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

Python's object system is sufficiently different from that of C++ that I
doubt the latter could used with much profit.

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

Proposed and rejected. Not every C programmer knows or wants to learn C++.

--
Terry Jan Reedy

From: Roy Smith on
In article <4c55fe82$0$9111$426a34cc(a)news.free.fr>,
candide <candide(a)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.
From: John Bokma on
Roy Smith <roy(a)panix.com> writes:

> In article <4c55fe82$0$9111$426a34cc(a)news.free.fr>,
> candide <candide(a)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.

In the beginning of C++ there were programs that just converted C++ to C
(frontends). At least that is how the C++ compiler Acorn sold worked.
So I don't think your argument was much true back then.

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development