0 votes
in Python by
What is the function of “self”?

1 Answer

0 votes
by

“Self” is a variable that represents the instance of the object to itself. In most of the object oriented programming language, this is passed to the methods as a hidden parameters that is defined by an object. But, in python, it is declared and passed 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 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”.

Related questions

0 votes
asked May 17, 2020 in Python by SakshiSharma
0 votes
asked Dec 28, 2023 in Rust by Robin
...