use of "self", was "No Do while/repeat until looping construct in python?"

William Sonna wsonna at attglobal.net
Sat Mar 15 14:03:34 CET 2003


On Fri, 14 Mar 2003 13:20:53 -0500, Chermside, Michael wrote:

[snip]

> PS: Problem for the readers: name another advantage of using self
> BESIDES distinguishing local and instance scopes. Extra credit if you
> come up with one I haven't heard before.

I'll take that one on - "Effective Java - Bloch"

"Item 16 - Prefer interfaces to abstract classes".  The author makes a
pretty convincing case for interfaces because all things being equal, less
state is better.

Well, all things are rarely equal, and Python has neither interfaces nor
abstract classes.

But if you take that point one step further to gratuitous state is
usually trouble, Python actually helps you out quite a bit.  It makes
it painful, thus discouraging it.

Now does THAT qualify for extra credit?




More information about the Python-list mailing list