New to Python: my impression v. Perl/Ruby
francisgavila at yahoo.com
Tue Jan 20 05:09:06 CET 2004
Wayne Folta wrote in message ...
>(Actually, now that I reread it, I should've said "pure OO", which I
>believe is more reflective of their statements. And this has some basis
>in fact, I believe, if you look at the v1 of Ruby and Python and what
>is first-class and what is not.)
>Again, as you yourself say, they chose to subclass protocol services
>off of a class 'protocol' and Python did not. In fact, Python chose to
>not subclass POP3 from anything. Why? Because of the culture, in my
>opinion. Ruby emphasizes OO and that it's "pure OO" (their opinion) and
>so an implementation that involves a Smalltalk-ish subclassing of
>everything recommends itself.
>Python has a different culture where such strict tree-like class
>structure does not recommend itself. Python's "batteries included"
>philosophy resulted in a more straightforward and (mostly) better
>documented way to do it.
>Intellectually, I prefer Ruby. Ruby and Smalltalk intrigue me. But the
>"pure OO" approach (my words this time) is annoying, and even at some
>point inconsistent, as I mentioned in my paragraph about 0.step(). I
>feel like Python has got the right balance where it's OO and pretty
>much fully so, but not fanatically so. And it's what I've adopted.
Some time ago I wrestled with the Ruby-Python claim-counterclaim to "purity"
Anyway, as yet I fail to see how one can be considered more "pure" than the
other. Ruby prefers subclassing, but this seems cultural rather than
technical. Further, Python can be said to be more "pure", in the naive
sense that everything that's first class is an object, and more entities are
first class in Python (e.g. methods). I don't think this is a *good*
argument, but it's not a ludicrous one, because it at the very least
illustrates that we don't know what the heck "pure" means in this context.
To me, the argument that there is a direct correspondence between "OO
purity" and "similarity to SmallTalk" begs the question, because it
presupposes that SmallTalk is pure OO. But there's nothing about SmallTalk,
aside from the historical accident of being one of the first languages to
use objects pervasively, which suggests to me that its is the "purest" way
of doing OO. Rather, OO is too general a concept to admit of a single
paradigm which is imitated to greater or lesser degrees in one or another
language. The difference between Ruby and Python already illustrates that
OO does not admit of a single paradigm, because of the attribute/message
distinction. Which is more pure? It's like asking whether meat as food is
more pure than vegetables.
Of course, this is just my current thinking on the subject. If someone
presents an argument that Ruby is more pure which I find compelling (Leaving
aside the old CPython wart of unsubclassable base types.), I'll certainly
repent my assessment. But I'll still prefer Python, because using 'impure
OO' doesn't bother me one bit. ;)
More information about the Python-list