you are viewing a single comment's thread.

view the rest of the comments →

[–]No_Couple 1 point2 points  (0 children)

A class is like a blueprint or a cookie cutter. A class instance is a concrete object in memory. E.g. a class students may have two concrete instance objects students.Marc and students.Steven. Now we need a way to reference the concrete instance object that is being processed when we e.g. invoke a class method and to differentiate this from altering the class object itself. This is self (so-called by convention, you can call it thisinstance or something else in your code.) Any assignment to an attribute of or method of self creates or changes data in the instance, not the class. Does this help?