What do init and self do in Python duplicate

0 votes

During my Python lectures, I've come across a doubt and stuck in that and I'm not really sure how to handle.

def method(self, blah):
    def __init__(?):
        ....
    ....

What is the function of self? and is it required?

The __init__ method's purpose is what? Why is it required? (etc.)

Though I don't know much, I believe they could be OOP constructs.

Aug 31, 2023 in Python by Edureka
• 220 points
288 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

What do "init" and "self" do in python ?

In Python, `init` and `self` are related ...READ MORE

answered Oct 5, 2023 in Python by anonymous
• 3,360 points
874 views
+1 vote
7 answers
0 votes
1 answer

__init__ and self in python

The self variable represents an instance of ...READ MORE

answered Sep 18, 2018 in Python by SayantiniDeb
• 200 points
980 views
+3 votes
2 answers

What does Python _init_ and self do?

Hey @Anirudh!  Self The self keyword is used to access ...READ MORE

answered Oct 31, 2018 in Python by Omkar
• 69,220 points
6,768 views
0 votes
1 answer

What is the key difference between self in ruby and self in python?

Ruby and Python are actually very different languages (although ...READ MORE

answered Jul 30, 2019 in Python by Mohammad
• 3,230 points
1,113 views
0 votes
1 answer

Can you explain what is the use _init_ and self in python?

Hi, The basic difference between these two are _init_ ...READ MORE

answered Aug 14, 2019 in Python by anonymous
1,498 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,464 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP