Self Nanny

Doug Landauer landauer at apple.com
Tue Mar 7 21:42:36 EST 2000


> >> 3) BUT I think that it would be *nice* not to have to specify "self" in
> >> method definitions, and it would certainly help A LOT of newbies

It would help A FEW newbies at the very great cost of making many
of their methods harder to read.  One writer, many readers ==> it's
much more important for it to be readable than for a newbie to save
five characters and a bit of head-scratching.


> Personally, I'd rather not ever have to write 'self' or 'self.anything'.
> It contributes nothing to the code   [...]

Having had to grovel through a whole bunch of "not-mine" C++ code, I sure
wish that C++ had required  "this->"  everywhere.


> This is both true and annoying. In our search for better ways to do
> things we keep running into this barrier that languages are written,
> tried and much time & effort put into that trial. Then when someone
> says, "Couldn't we do it better this way?", the answer is, "But, we've
> put so much work into this..."

Actually, my answer here is "No, that way is *NOT* better.  It is
distinctly worse for nearly everyone except the newbie who is writing
his first or second class."


> All I'm saying is there should be ways to move to new better ways
> of doing things without having to face such stiff resistance.

In any kind of programming, a change like this has to be shown to
be better.  In fact, it usually has to be at least twice or three
times better before it can overcome the inertia of existing,
working code.  This suggested change is not even better, let alone
much much better.  IMHO.
-- 
    Doug Landauer        landauer at apple.com (work)
                         landauer at scruznet.com (not-work)



More information about the Python-list mailing list