Answer Posted / chaitanya
“Self” is a reference variable and an instance attribute that is used instead of the local variable inside the class. The function or the variable of the self like self.x or self.meth() can be used in case the class is not known. There are no variables declared as local. It doesn’t have any syntax and it allow the reference to be passed explicity or call the method for the class that is in use. The use of writebaseclass.methodname(self, <argument list>) shows that the method of _init_() can be extended to the base class methods. This also solves the problem that is syntactic by using the assignment and the local variables. This tells a way to the interpreter the values that are to be used for the instance variables and local variables. The use of explicit self.var solves the problem mentioned above.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Can I use notepad ++ for python?
Will exit method in python de allocate the global namespace?
What is the key difference between a list and the tuple?
What is the best free ide for python?
Is python statically typed or dynamically typed?
Can we develop a site using python
What is a method call?
What is super () react?
What is meant by instantiating a class?
How do you find the current version of python?
What tuple means?
What is set function in python?
How can I execute arbitrary python statements from c?
Is print a function in python 3?
What is python xrange?