Newbie question: what's with "self"?

donkeyboy fivenastydisco at hotmail.com
Tue Aug 8 12:26:51 EDT 2006


This is probably a really basic question, but anyway ...

I'm new to both Python and OO programming. From looking at a number of
code examples, the word "self" is used a lot when referring to classes.
As such, what does "self" mean and/or do? I've read things that say
it's a naming convention, but no-one has really spelt it out (in idiot
form!) in a way I can understand.

Any help you can provide would be great: at the moment, when code
doesn't work as expected, I'm randomly sprinkling "self"s in all over
the place to see if that helps, but without much of an idea of what it
really achieves. 

Thanks in advance!!




More information about the Python-list mailing list