1By using the “self” keyword we can access the attributes
2and methods of the class in python.
3It binds the attributes with the given arguments.
4self is parameter in function and user can use another parameter
5name in place of it.
6But it is advisable to use self because,
7it increase the readability of code.
1class SqPoint(Point):
2 MAX_Inst = 4
3 Inst_created = 0
4
5 def __new__(cls,*args,**kwargs):
6 if (cls.Inst_created >= cls.MAX_Inst):
7 raise ValueError("Cannot create more objects")
8 cls.Inst_created += 1
9 return super().__new__(cls)