31 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
Amity University, Noida Law A...
Apply
700+ Campus placements at top national and global law firms, corporates, and judiciaries
Amity University Noida B.Tech...
Apply
Among Top 30 National Universities for Engineering (NIRF 2024) | 30+ Specializations | AI Powered Learning & State-of-the-Art Facilities
Amity University, Noida BBA A...
Apply
Ranked amongst top 3% universities globally (QS Rankings)
UPES | BBA Admissions 2025
Apply
#41 in NIRF, NAAC ‘A’ Grade | 100% Placement, up to 30% meritorious scholarships
UPES B.Tech Admissions 2025
Apply
Ranked #42 among Engineering colleges in India by NIRF | Highest CTC 50 LPA , 100% Placements
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