There is the following difference between the self and __init__
self:
self represents the instance of the class. By using the “self” keyword we can access the attributes and methods of the class in python. It binds the attributes with the given arguments.
__init__:
_init__ is a constructor of python classes and it is called automatically whenever a new object is instantiated.
Answer :
There is the following difference between the self and __init__
self:
self represents the instance of the class. By using the “self” keyword we can access the attributes and methods of the class in python. It binds the attributes with the given arguments.
__init__:
_init__ is a constructor of python classes and it is called automatically whenever a new object is instantiated.
need an explanation for this answer? contact us directly to get an explanation for this answer