Interview Questions

What is self?

Python Questions and Answers


(Continued from previous question...)

What is self?

Self is merely a conventional name for the first argument of a method. A method defined as meth(self, a, b, c) should be called as x.meth(a, b, c) for some instance x of the class in which the definition occurs; the called method will think it is called as meth(x, a, b, c).

(Continued on next question...)

Other Interview Questions