46 Views

What is self in Python programming language


srikarkandukuri467 24th Oct, 2021
Answer (1)
Nitin Mereddy 24th Oct, 2021

Self is an object or an instance of a class. This is explicitly included as the first parameter in Python. On the other hand, in Java it is optional. It helps differentiate between the methods and attributes of a class with local variables.


The self variable in the init method refers to the newly created object, while in other methods, it refers to the object whose method was called

Related Questions

MAHE Manipal M.Tech 2025
Apply
NAAC A++ Accredited | Accorded institution of Eminence by Govt. of India | NIRF Rank #4
Graphic Era (Deemed to be Uni...
Apply
NAAC A+ Grade | Among top 100 universities of India (NIRF 2024) | 40 crore+ scholarships distributed
Indrashil University | B.Tech...
Apply
Apply for B.Tech | AICTE Aproved | UGC Recognized | International Collaborations for Global Edge | 100% Placement Assistance
Manav Rachna-MBA Admissions 2025
Apply
41000+ Alumni network | Students from over 20 countries
Manav Rachna-B.Tech Admission...
Apply
NAAC A++ Grade | NBA Accredited B.Tech programs | 41000+ Alumni network | Students from over 20 countries
JSS University Noida MBA 2025
Apply
170+ Recruiters Including Samsung, Zomato, LG, Adobe and many more | Highest CTC 47 LPA
View All Application Forms

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books