Why the 'self' argument?

Jonathan Aquino Jon_Aquino at shaw.ca
Sat Sep 6 12:30:41 EDT 2003


Two reasons I cringe when I see self as the first parameter of method
declarations (i.e. "def methodname(self, ...)" (I don't mind self in
the method body)):

1) I abhor redundancy. My first impression on seeing self as the first
parameter of all method declarations is that it seems redundant -- it
probably isn't technically, but it looks redundant: (self, (self,
(self, (self, ...

2) The number of parameters in the method call is one less than the
number of parameters in the method declaration. I'm annoyed when I see
this because I want the rules of the language to be obvious (in this
case, a one-to-one mapping). I would be embarassed to have to explain
this to a beginning programmer.

(I do like how Python indenting indicates blocks, however)




More information about the Python-list mailing list