Why a class when there will only be one instance?
Roy Smith
roy at panix.com
Tue May 25 21:20:02 EDT 2004
Ryan Paul <segphault at sbcglobal.net> wrote:
> defining a class may be useful if you plan on making more instances down
> the line. It's a good OO strategy. I do understand your dislike of 'self'.
> It does seem like clutter. In my code, I shorten it to 's'.
Please don't do that. While it's true that the first parameter of a
class method can be named anything, the use of "self" is so
overwhelmingly ubiquitous it might as well be a standard. Using
anything else is just going to make your code more difficult for anybody
else to read and understand.
Typing is cheap. Thinking is expensive. And, yes Aahz, you can quote
me on that :-)
More information about the Python-list
mailing list