Python misconceptions in IBM Ruby article...

Michael Hudson mwh21 at cam.ac.uk
Mon Feb 21 18:19:21 CET 2000


John Farrell <jfarrell at mincom.com> writes:

> Now, I do not propose that this be changed, and I do not claim that
> other languages are better because of this. However I do claim that there
> is a tacked-on feeling about it. 

As I tried to explain in an earlier post , there is not really any
other way to do it, given large gobs of the rest of Python.

The problem is: without a `self' argument, how on earth do you
distinguish between references to local and instance variables, given
that you don't declare variables?

It would be possible to do something a bit like the `global' keyword
so you would them write methods like:

class Class:
    def sety(x):
        instance y
        y = x
    def gety():
        return y # maybe this would work

but do you really think this would look less tacked on? You'd need a
keyword equivalent to `this' in C++, too.

> I think it's a little bit disingenuous
> to disparage the Ruby article for claiming that Python's OO features
> feel added-on, when there is considerable evidence to support that claim.

I posit that here `evidence' == `things different from what I am used
to'. In the absence of declarations, there aren't many ways to
distinguish instance vars from locals, and prefixing `self.' to them
seems as good as any other.

The absence of class methods also seems to me to be bogus, a result of
people trying to write C++ or Java in Python. But maybe I'm wrong...

open-you-mind-you-never-know-what-might-drop-in-ly y'rs
Michael

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list