Self is a keyword in Python used to define an instance or an object of a class.
In Python, it is explicitly used as the first parameter, unlike in Java where it is optional. It helps to differentiate between the methods and attributes of a class from its local variables.
The self variable in the init method refers to the newly created object while in other methods, it refers to the object whose method was called.
The self is a Python keyword which represents a variable that holds the instance of an object. In almost, all the object-oriented languages, it is passed to the methods as a hidden parameter.
This article is contributed by Prakash. If you like dEexams.com and would like to contribute, you can write your article here or mail your article to firstname.lastname@example.org . See your article appearing on the dEexams.com main page and help others to learn.