Q:

classes in python with self parameter

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. 
9
class Class(parentClass):
    def __init__(self,arg):
        self.arg = arg
        
    def function(self):
        print(arg)
5

New to Communities?

Join the community