[Baypiggies] Frequently Argued Objections

Aahz aahz at pythoncraft.com
Mon Jun 23 05:45:01 CEST 2008

On Sat, Jun 21, 2008, Warren Stringer wrote:
> Yee HAW!  Here, have some beef jerky while I explain why us cowboy  
> programmers are annoyed: Self has to be explicitly used yet is  
> implicitly passed as a parameter. Second, when counting keywords in  
> the standard python library, "self" is the most common keyword,  
> beating the 2nd most common keyword by almost a factor of two. I  
> mentioned this to JJ, who says that he uses self and non-self in the  
> same code base. I would love to see an example where this is useful,  
> where the NRO wouldn't suffice. As a mere tenderfoot Pythonista, all I  
> see "self" doing is obfuscating the wide open white spaces that I have  
> grown to love.

Actually, it's only half-true that self is passed implicitly as an
argument (you are wrong that it is passed implicitly as a parameter):
the object you manipulate is the self.  You can look at it as either
implicit or explicit, but really it's kind of a gray area.

As for the need to use self explicitly within the body, there's imply no
other way in a dynamic language like Python to clearly specify whether
you're referring to the function/method namespace or the object

(For anyone confused, "parameter" refers to the formal declaration as
part of the function/method definition while "argument" refers to the
object passed at call time.)
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha

More information about the Baypiggies mailing list