user image

Preeti Tripathi

Job Interview Skills
English
2 years ago

45. Define self in Python

user image

Abhishek Mishra

2 years ago

This is included as the first parameter in Python directly. In Java, it is optional, thus this is not the case. Using local variables makes it easier to distinguish between a class's methods and attributes. In other methods, the self variable refers to the object whose method was called, however in the init method, it refers to the freshly formed object.

Recent Doubts

Close [x]