Why 'self' ?
Russell E. Owen
owen at astrono.junkwashington.emu
Wed Oct 31 12:39:40 EST 2001
In article <3BE04E7A.8E2CF101 at ces.clemson.edu>,
"Schaefer, F." <fschaef at ces.clemson.edu> wrote:
>It's been a while that I am working with Python and actually
>the only thing I really do not like about it is 'self' in the
>member function definitions as argument. If it
>has to be there anyway, it is totally redundant to write it.
>
>So, why is self there ?
I believe it was basically to make implementation of the language easier.
I certainly agree it's a problem. I find forgetting to include the
"self" argument to be one of the more significant sources of error in my
own coding. Aside from that, I find it confusing that the caller and
callee argument list are different.
There are a number of other weaknesses in the object model. Still...with
all their possible warts, Python classes are very useful, the
introspection mechanism is handy and the language overall is great --
powerful and fairly simple.
One interesting question is whether Guido sees "self" as a problem. If
he does, he might be tempted to fix it in some future incompatible
version (anybody know if version 3 is going to be the fabled
incompatible Python 3000?).
-- Russell
More information about the Python-list
mailing list