New to Python: my impression v. Perl/Ruby

Francis Avila francisgavila at yahoo.com
Mon Jan 19 23:09:06 EST 2004


Wayne Folta wrote in message ...
>John,
>
[snippage]
>(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.)

[snippage]

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

[snippage]

Some time ago I wrestled with the Ruby-Python claim-counterclaim to "purity"
in
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=vug18vkm
jpiice%40corp.supernews.com&rnum=1&prev=/groups%3Fq%3D%2522Francis%2BAvila%2
522%2Bruby%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3Dvug18vkmjpii
ce%2540corp.supernews.com%26rnum%3D1

(Whew)

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

--
Francis Avila




More information about the Python-list mailing list