Self Nanny

Tim Peters tim_one at email.msn.com
Wed Mar 8 08:05:17 CET 2000


[Lloyd Zusman, valiantly defending realism]
> ...
> Also, keep in mind that there indeed have been many many useful and
> meaningful "Couldn't we do it better this way?"  discussions about the
> implictness or explicitness of 'self' ... they took place maybe 5-10
> years ago when Python was still in the design and debate stage of
> development.

8 years ago to the nanosecond, and while "many" applies I'm not sure
"useful" or "meaningful" did <wink>.  IIRC, dropping "self." on references
wasn't the issue (that didn't pop up before C++ got popular), it centered on
whether "self" really needed to be explicitly listed in a method's formal
arglist.  That debate got quite hot.  Unfortunately, I can't make this
entertainingly suspenseful, since you already know how it turned out.

> ...
> There is an undocumented and probably unintended behavior of the
> Python 'append' method that people have been exploiting in certain
> applications.

Definitely unintended -- it's an artifact of an ancient change in the way
Python handled arglists.  Now *that* change was the result of many useful
and meaningful early discussions.  You can tell whether an early discussion
was useful and meaningful by whether Guido changed the language as a result
<wink>.

> ...
> It's very appropriate to "start over" when creating a new language.
> For example, Stroustrup did that to C when inventing C++.

Don't I wish.

BTW, while I'm not a fan of Hungarian notation in general, at work we have a
C++ naming convention violations of which are punishable by death:  all
class data members must be named beginning with "m" + an uppercase letter,
all file static data "s" + upper, and all extern data "g" (for global) +
upper.  So gErrorCount, sLogHelperTable, mNumBogons, etc.  The benefits in
making quick & accurate sense of unfamiliar code are enormous.  Note that
all code is unfamiliar a week after you write it <0.4 wink>.

love-explicit-self-&-it-will-return-your-adoration-threefold-ly y'rs  - tim






More information about the Python-list mailing list