[Solved] Why does Python call both functions?


In your object initialisation code, you have the following:

self.Grade = self.GetGrade()
self.LenGrade = self.GetLenGrade()

This means “set the value of the data member Grade to the value obtained by calling the method GetGrade” and the same for LenGrade.

It should not be surprising that they’re called, it would be more surprising if they were not.

solved Why does Python call both functions?