Guido van Rossum responds to Bruce Eckel: Why explicit self has to stay
neopythonic.blogspot.com
neopythonic.blogspot.com
But I quite like self: it's an explicit reminder every time you write OOP in Python about the idea of classes & instances.
Incidentally I'm one of those annoying people that often will use this instead of self (because I find it more readable.. at work I am famed for my efforts of trying to write code in "english" :D).
Self is also useful when your passing the class around. It's easy to see where it is heading all the time.
It will be nice to see the "you forgot self, you fool" error made explicit. When you switch languages a couple of times a day it can be easy to forget :) (PHP to Python switch is the hardest!)
def self.foo(arg): ...
variant GvR mentions reminds me of one of the many ways you can implement OO-style in Lua: function object.method(arg) ... endI much prefer Lua's solution for this over Python's (and I'm also coming to strongly prefer prototype-style OO, in general).
function obj:method(arg) .. end
is the same as function obj.method(obj,arg) .. end
I think the reason I mentioned the latter is I generally use Lua closures to code the way Eckel preferrs."Objects are a poor man's closures" -- Norman Adams
type Foo =
...
member self.Bar(arg) =
'self' can be named as you like.