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

What are common uses of Python decorators?
Python decorators are used for: 1. **Code Reusability**: They help apply the same functionality to multiple functions without repeating code.2. **Logging**: They can add logging capabilities to functions...
Narasimha
0 0
5

What are the future career opportunities after Python certification courses?

You can go for many career paths depending upon your interest. The most prominent of them are as follows: Python developer for automation Data Analyst ETL developer Web-Application Developer Machine Learning Expert Data Scientist Data Engineer
Rajnish
Who developed Python?
Python was developed by **Guid van Rossum** in 1991. He created it as a successor to the ABC programming language, focusing on simplicity, readability, and ease of use. Guid van Rossum continued to guide...
Govind
0 0
5
Which is better, PHP or Python? Why?
This question points to other question , What motive you want to learn or what you want to achive with them.
Issac
0 0
8

I want to learn Python. but I cant decide which application to choose.I don't understand if I should be a Developer, testing or something else which is the future and which is more in demand.

Hello,You should first go for Python basics and practice some basic programming. Then advance your skillset.Python is quick to learn and use Pycharm as the IDE as it is widely used in the industry.
Srinu

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

Ask a Question

Related Lessons

Python Demo
https://www.youtube.com/watch?v=8AEhpZ4lbOI

Python Puzzle: Find The Checksum To Ensure Flawless Data Transfer
Find below the puzzle: sampleInput='''5195 753 2468''' The first item's(5195) largest and smallest values are 9 and 1, and their difference is 8. The second item's(753) largest and smallest values...

Python/Dejango Training
Python/Django Training Content Duration: 2.5 months 1. Introduction to Python Python - The Universal Language 2. Getting Started Installing Python Python - *Hello World* Using the Interpreter Python...

10 Best Python IDEs
Python is a very popular programming language. It's open source and used today as scripting language, web development, mobile and desktop in many areas thanks to the endless modules options it has While...

Write your first Python program in 10 minutes
1. Download python from python official site search "python download" in google 2. Install in your machine 3. verify using : "python --version" command 4. Write first program using notepad create...

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