was python implemented as a object oriented langage at the beginning ?

John Roth JohnRoth1 at jhrothjr.com
Tue Oct 3 11:29:36 EDT 2006


Fredrik Lundh wrote:
> Bertrand Ballis wrote:
>
> > I heard a lot of people from the Ruby community claiming that Python, like
> > Perl, was a scripting langage that was changed aftewards to be object
> > compatible, and that was making it not as good as Ruby, object-oriented
> > from the begenning.
> >
> > Is that true ?
>
> nope.
>
> </F>

Since the original isn't showing up on Google Groups,
I'm going to hijack this response to make a longer
answer.

One problem with the frequently made assertion that
Ruby is "real" OO and Python isn't is that the person
making it usually doesn't say what they think "real"
OO is all about. It raises the suspicion that they're
repeating something they've heard without thinking
it through for themselves.

There are some significant differences. Python, like
C++, is multi-paradigm. That means that it's got
procedural elements such as the built-in functions.
Ruby doesn't: everything you can do is a method on
an object.

Another difference is that in Ruby, like Java,
everything descends from a single root object.
This is typical for a single inheritance language,
and not typical for a multiple inheritance language.
In Python all objects don't descend from a single
root object, although all new style classes do;
old style classes will vanish in release 3.0.

In Ruby, all objects are modifyable at runtime.
In Python many objects aren't, although most of
them can be subclassed. There is actually a
decent example of where this is useful: see the
rSpec language where they put a method named
"should" directly on object, for good reason.

John Roth




More information about the Python-list mailing list