What is self mean ? in 3,4,5 line

class SchoolMember:

  school_name = "KV"    

  def init(self, name, age):

    self.name = name

    self.age = age

class Teacher(SchoolMember):

  def init(self, name, age, salary):

    SchoolMember.init(self, name, age)

    self.salary = salary

t1 = Teacher('Mrs. Rawat', 40, 30000)

t2 = Teacher('Mr. Malik', 30, 20000)



print (t1.school_name)

print (t1.name)

print (t2.salary)

print (t2.school_name)

Hello Manav,



A class definition like this one,  SchoolMember, is used to create objects. It's like the blueprint of a building. The same blueprint can be used to create multiple similar-looking buildings. Similarly, each class definition can have multiple objects made out of it. 



"self" here is a keyword by python for us to be able to reference or use "the object being talked about". All the code within a class will eventually be invoked by specific objects made from that same class. To be able to reference these specific objects within the class code we use the keyword "self". "self" here means the object itself which belongs to class SchoolMember and is being used to access attributes of the class, this case, like name and age. 



self.name is the use of the name attribute of class SchoolMember within the code of the class. "self" is like saying "this particular object that I am talking about"