Why the 'self' argument?

John Roth newsgroups at jhrothjr.com
Fri Sep 5 16:33:37 CEST 2003

"Grzegorz Staniak" <gstaniak at inka.zagiel.pl> wrote in message
news:slrnblh5ru.nd5.gstaniak at inka.zagiel.pl...
> Hello,
> I'm a newbie Python user, a systems administrator - I've been trying
> to switch from Perl to Python for administrative tasks - and one thing
> I cannot understand so far is why I need the special 'self' (or anything
> esle) argument in class method definitions. I might have missed an
> explanation in the docs, a quick Google search did not help. Is there
> somewhere on the web you could direct me to?

It's in the FAQ somewhere.

Technically, it would be possible to make "self" a reserved
word, and not have to put it in the method declaration. However,
there are a lot of people who use something other than the
word "self," so that would break existing code.

John Roth

> Thanks,
> -- 
> Grzegorz Staniak <gstaniak at zagiel.com.pl>

More information about the Python-list mailing list