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.
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.
Sounds like a bunch of hooey on both counts ("alot of people claiming" and "python not OO"). The python object system is closer to C++, ruby's is closer to SmallTalk; but they are both OO (i.e., everything is an object), and support all the OOP distinctives (i.e., encapsulation, abstraction, &c) -- just because a language doesn't implement OO in the exact same way as another doesn't mean it isn't OO -- it just means it's a different language. Sounds like mabye you heard a few ruby zealots who didn't know what they were talking about.
> > 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.
MonkeeSage wrote: > [...] just because a language doesn't implement OO in the > exact same way as another doesn't mean it isn't OO -- it just means > it's a different language.
I've a suspicion that folk who aren't familiar with the Python object system automatically assume the phrase 'Python types' means C++/Java-style primitives - which it doesn't. Python's type/class distinction may be klunky and inelegant, but it's still OO.