4
Reply

What is self in Python?

Dinesh Beniwal

Dinesh Beniwal

6y
1.7k
2
Reply
    self is used to pass the reference to the current class. self solves the same purpose that is achieved by "this" in javaunlike "this", it is a compulsion to pass self in python
    test
    Self represents an instance of the class, By using "Self" we can access the attributes and method of the class in a python.
    Self is like this keyword in php