What is the point of self.x = x?

class Car:

def __init__(self,make,model,year):
#---snipped code 
  • Why can it not be make = self.make i.e. the reverse?
  • What is exactly the point of self.make = make assignment?


The variable self refers to the current object and self.make is an attribute of this object. The variable make is just a local variable whose scope ends at the end of the __init__ method. The assignment thus serves to save this variable into the object so that its other methods can refer to it, vaguely like a global variable except it’s local to this class, and each instance of the class (each object) has its own private copy.