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 is setup script?

0 Answers  


What is sockets? Explain.

0 Answers  


What is python unit test?

0 Answers  


What is the pass statement in python?

0 Answers  


What does ** (double star) and * (star) do for python parameters?

0 Answers  






What is the use of isupper keyword in python?

0 Answers  


Differentiate list and tuple with an example?

0 Answers  


What is __ doc __ in python?

0 Answers  


What does serialization mean in python?

0 Answers  


What is python? State some programming language features of python.

0 Answers  


Explain how to redirect the output of a python script from standout(ie., A monitor) on to a file?

0 Answers  


Given the first and last names of all employees in your firm, what data type will you use to store it?

0 Answers  


Categories