Self Nanny

Lloyd Zusman ljz at asfast.com
Mon Mar 6 20:52:19 EST 2000


[ Attribution to Clarence Gardner <clarence at netlojix.com> was snipped in
  the post I'm replying to.  I've re-instated it, below ... ]

Gaetan Corneau <corg at copernic.com> writes:

> Clarence Gardner <clarence at netlojix.com> writes:
> >
> > [ ... ]
> >
> > I would guess C++ newbies have as many problems.  Especially when
> > they get into the situations where they have to start explicitly
> > using 'this'.
> 
> Yes, C++ is complicated. The "this" pointer subject is a difficult
> one for new programmers.  But I don't want to discuss C++, I just
> want to see Python more widely accepted :)

I'd be willing to bet you that you can't find more than a handful of
people in the world who would reject or avoid Python because of the
explict "self".  Be honest: how many people do you really know (C++
programmers or otherwise) who would gladly start using Python if only
it didn't require an explicit "self"?


> > [ ... ]
> >
> > Three years ago, as a long-time programmer but brand new to Python, I
> > applauded the Python approach.
> 
> I don't discuss your preferences. *Personally*, I find the
> declaration AND use of "self" annoying in a language I use for rapid
> development/prototyping.

You only want to discuss *your* preferences and no one else's?

> Would programmers who have a background in a language other than C++
> really miss "self" in the method declarations? I would be interested
> to see what Python programmers in general think of that. You know, I
> don't care much personally, since I have been using Python long
> enough to have developed the "self declaration reflex" :)

So you *do* want to know people's preferences after all (make up your
mind).

OK, so here are my thoughts: I have programmed quite a bit in Python,
and in C++, and in Java, and in Smalltalk, and in C, and in Perl, and
in FORTRAN, and in Basic, and in COBOL, and in Lisp, and in various
flavors of assembly language, and in a few other various and sundry
things.  As far as I'm concerned, whether there is an explict
self-like argument in method calls as in Python, or an implicit
this-like variable as in C++ is almost completely irrelevant to
anything that I would consider to be important to users of the
languages, be they novices or experts or anywhere in between.

And in my many years of experience, I have encountered an almost
microscopic percentage of newbies in C++, Python, Java, Smalltalk, and
other O-O-type languages whose problems learning the language have
been related even remotely to the explicitness or implicitness of
this-like and self-like contructs.

Furthermore, as I mentioned in another recent post, there are millions
of lines of legacy Python code out there right now which would break
if Python were to suddenly implement an implicit "self" argument.

So I ask, why change this behavior at all?

Are the large numbers of expensive person-hours needed to change all
the legacy Python code out there really worth making an alteration in
the language which would upset a large number of existing users, and
at best satisfy a tiny percentage of the others?

I say no.

If Python was a new language that was still in the stages of design
and debate, this explicitness-versus-implicitness of 'self' would
probably be worth debating.

But you're several years and millions of lines of code too late now
with regard to Python.

As I suggested in my earlier post, perhaps you should invent your own
Python-like language that manages 'self' differently in method calls.
Then, your ideas about the implictness of 'self' would have much more
of a chance of being taken seriously.

-- 
 Lloyd Zusman
 ljz at asfast.com



More information about the Python-list mailing list