UrbanPro

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What does "self" mean in a Python class? Why do we need it?

Asked by Last Modified  

2 Answers

Learn Python

Follow 2
Answer

Please enter your answer

Web developer with more than 4 years of experience.

Think about self as a function that i created for myself.(by myself i mean the object) When we use self we are refering to any future instance that we may create and store data. on self we can create any functions and all other things required for that object. self allows us to also access functions...
read more

Think about self as a function that i created for myself.(by myself i mean the object) When we use self we are refering to any future instance that we may create and store data. on self we can create any functions and all other things required for that object. self allows us to also access functions of the current class inside the same class.

read less
Comments

IIT Roorkee Grad and an IT Professional with 10 Years of Experience

There are methods and functions in python. Methods specifically refer to functions that are defined within a class or are bound to a particular class. functions on the other hand are not bound to any class and are available globally. So when I am defining a method in a class which needs to call another...
read more

There are methods and functions in python. Methods specifically refer to functions that are defined within a class or are bound to a particular class. functions on the other hand are not bound to any class and are available globally. So when I am defining a method in a class which needs to call another method inside the same class, how will we do it? If we simply use the method name and pass the parameters it will not work as it will try to find functions defined globally. But if you do self.method_name() then it will work. So this is one scenario that shows the usage of self in python. Using self we can call methods defined inside the current class. Think of the self as a pointer to a class object. So when you do self.method_name() the method_name defined inside the class will execute

read less
Comments

Related Questions

i recently completed my M.Tech EEE is it the right choice to learn Python now. And i completely have interest in programming only if available get me the tutor details.
This would be a great time to start learning python. With the increase in the amount of data being generated every day + improved compute efficiency, there is revolution that is taking place in data analytics...
Adupa
Hi, I'm BCA graduate, and I have seven years in the general insurance field now I want to change my profile and upgrade my knowledge. Will learning python help me with my growth in my career?
Hi, as far as my knowledge goes first, you should learn data processing tools or programs like MS Excel, Power Bi, or SQL then you should then take a leap into Python, which will make automating your work quite simple.
Supriya

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

JAVA - Object Cloning
JAVA - Object Cloning Is the way of creating the same copy of object without calling the class constructor. It means we can make any class object multiple times without calling its default constructor....

Python Programming
Python is a widely used general-purpose, high-level programming language. This is an Open Source Software and its source code is available with a license in which the Copyright holder provides the rights...

File Handling in Python - Basic Concept
File (Flat) Handling in Python Types of files in python: 1: Text file: Stores data in the form of characters. Customarily used to store text/string data. 2: Binary file: Stores data in the form of bytes....

Why Python
Python can be used in any futuristics technology A= Analytics Data Science Artificial Intelligence(AI) Neural Network(NN) Natural Language Processing(NLP) Computer Vision(OpenCV) In Analytics...

Facebook Analytics
Assume how the Facebook application will store the millions of customer's record in real-time: facebook = { 'jose': { 'name': 'jose', 'age': 33, 'hobby': , # cricket,football 'mobile': 1111111111, 'email':...

Recommended Articles

Python is one of the most popular programming languages in the world. It is general-purpose, object oriented, high-level programming language used in a number of programming fields. Python is a great programming language to learn as it will introduce you to the world of programming. If you are from the technical background...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for Python Training classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more