What is the function of “self”?



What is the function of “self”?..

Answer / chaitanya

“Self” is a variable that represent the instance of the object to itself. In most of the object oriented programming language, this is passed as to the methods as a hidden parameters that is defined by an object. But, in python it is declare it and pass it explicitly. It is the first argument that gets created in the instance of the class A and the parameters to the methods are passed automatically. It refers to separate instance of the variable for individual objects. This is the first argument that is used in the class instance and the “self” method is defined explicitly to all the methods that are used and present. The variables are referred as “self.xxx”.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What are the built-in types available in python?

0 Answers  


What is use of list comprehension ?

0 Answers  


How is python used in the real world?

0 Answers  


What are the features of python?

0 Answers  


Explain class __init__()?

0 Answers  






How do you find the current version of python?

0 Answers  


What do you understand by python iterator and iterable elements?

0 Answers  


Explain how to make Forms in python.

1 Answers  


Where is python best used?

0 Answers  


How would you display a file’s contents in reversed order?

0 Answers  


Is all the memory freed when python exits?

0 Answers  


Is there a constructor in python?

0 Answers  


Categories