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
Explain try keyword?
Why is the order in python dictionaries and sets arbitrary?
What is the comment tag in Python ?
What are types in python?
How will you verify different flags at once?
Explain what is the common way for the flask script to work?
What does isnull mean in python?
How are uuid generated?
What is the accomplishment you are most proud of?
What is the output of this line?
Write code to print everything in the string except the spaces.
Can you explain the life cycle of a thread?
What does code coverage mean?
What does nan mean in python?
What are functions in python?