so basically its like this //when object is created a=A() //this init is called //similarly say class A: def __len__(self): print("dd") a=A() len(a) //prints dd basically python knows that magic method __len__ is to be called for len(a)