[Python-3000] Removing 'self' from method definitions

Gustavo Niemeyer gustavo at niemeyer.net
Thu Apr 13 19:13:01 CEST 2006


(...)
> The traditional way of calling superclass methods and getting an unbound 
> method should still work.  It just won't be symmetric with the way the 
> functions are defined.  Since this is not the typical way methods are 
> called, it seems reasonable.

Using "obj.some_method(blah)" when something is defined as
"def some_method(self, blah):" is easy to understand since someone
may be filling the "self" parameter for you (partial functions
anyone?), but using "Class.some_method(self, blah)" when something
is defined as "def some_method(blah):" looks bizarre.

I've programmed for a long time in other languages where "self" is
implicit, and have also programmed in Python for many years
using the explicit "self". The explicit "self" in Python completely
matches with the features of the language, IMO. Making it implicit
would be a huge mistake, and one that would most probably seem
absurd if you have used Python for a while and haven't had contact
with other languages that introduce a very magic "self" in some
contexts of your program.

-- 
Gustavo Niemeyer
http://niemeyer.net


More information about the Python-3000 mailing list