Is multilevel inheritance good or bad

Python course

"" "The Calendar class implements a calendar." "" ClassCalendar (object): months = (31,28,31,30,31,30,31,31,30,31,30,31) date_style = "British" @staticmethoddefleapyear (year): "" "The leapyear method returns True if the parameter year is a leap year, otherwise False" "" ifnotyear% 4 == 0: returnFalseelifnotyear% 100 == 0: returnTrueelifnotyear% 400 == 0: returnFalseelse: returnTruedef__init __ (self, d, m, y): "" "d, m, y must be integer values ​​and the year must be a four-digit year" "" self.set_Calendar (d, m, y) defset_Calendar (self, d, m, y): "" "d, m, y must be integer values ​​and the year must be a four-digit year number" "" iftype (d) == intandtype (m) == intandtype (y) == int: self .__ days = dself .__ months = mself .__ years = yelse: raiseTypeError ("d, m, y must be whole numbers!") def__str __ (self): ifCalendar.date_style == "British": return "{0: 02d} / {1:02d} / {2:4d }".format(self.__days,self.__months,self.__years)else:# under d he assumption of an American style return "{0: 02d} / {1: 02d} / {2: 4d}". format (self .__ months, self .__ days, self .__ years) defadvance (self): "" "This method will forwarded to the next date. "" "max_days = Calendar.months [self .__ months-1] ifself .__ months == 2andCalendar.leapyear (self .__ years): max_days + = 1ifself .__ days == max_days: self .__ days = 1ifself .__ months == 12: self .__ months = 1self .__ years + = 1else: self .__ months + = 1else: self .__ days + = 1if__name __ == "__ main __": x = Calendar (31,12,2012) print (x, end = "") x.advance () print ("After advance:", x) print ("2012 was a leap year:") x = Calendar (28.2,2012) print (x, end = "") x.advance () print ("After advance:" ", x) x = Calendar (28,2,2013) print (x, end =" ") x.advance () print (" After advance: ", x) print (" 1900 no leapyear: number divisible by 100 but not through 400: ") x = Calendar (28,2,1900) print (x, end =" ") x.advance () print (" After advance: ", x) print (" 2000 was a leap year because the Number is divisible by 400: ") x = Calendar (28,2,2000) print (x, end =" ") x.advance () print (" After advance: ", x) print (" Change to American date style: ") Calendar.date_style =" American "print (" After advance: ", x)