Try it here
Subscribe
Self in Python

What is self in Python

what_is_self_in_python

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.

Writer profile pic

Prakash on Apr 21, 2020 at 12:04 am


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 admin@deexams.com . See your article appearing on the dEexams.com main page and help others to learn.



Post Comment

Comments( 0)

WEB TECHNOLOGY

Articles

×

Forgot Password

Please enter your email address below and we will send you information to change your password.