Q:

What is the difference between self and __init__ methods in python Class?

0

Answer :

What is the difference between self and __init__ methods in python Class?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer :

There is the following difference between the self and __init__

self:

self represents the instance of the class. By using the “self” keyword we can access the attributes and methods of the class in python. It binds the attributes with the given arguments.

__init__:

_init__  is a constructor of python classes and it is called automatically whenever a new object is instantiated.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python Interview Questions and Answers

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is the return keyword used for in python?... >>
<< What is __init__ in Python?...