[Tutor] Hello and newbie question about "self"

Patrick python-list at puzzled.xs4all.nl
Sun Feb 3 21:15:59 CET 2008


Hi guru's,

New to the list. I bought O'Reilly's Learning Python (3rd edition for
2.5) a while back. Slowly making my way through it and was pleasantly
surprised that Python seems easier than C. Until...I bumped into the
"self" thingy.

Can anyone please point me to a document that explains "self" in
layman's terms. Or lacking such a doc throw in a much appreciated
layman's explanation what "self" is and when/where to use it? 

In the book (so far) I've seen "self" pop up in these examples (on pages
457 and 458):

class C1(C2, C3):
    def setname(self, who)
        self.name = who

class C1(C2, C3):
    def __init__(self, who)
        self.name = who

Thanks for any pointers!

Regards,
Patrick



More information about the Tutor mailing list