Why a class when there will only be one instance?
Ryan Paul
segphault at sbcglobal.net
Wed May 26 11:00:38 EDT 2004
On Tue, 25 May 2004 21:20:02 -0400, Roy Smith wrote:
> 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 :-)
I dont conform to a bad standard just because it's a standard. If I did, I
would be using java instead of a dynamic language like python. If other
people dont like it, thats too bad- they dont have to use my code.
More information about the Python-list
mailing list