the date abstract data type comments class definitions and methods should be properly commented to aide the user in knowing what the class and/or methods do to conserve spacehoweverclasses and methods presented in this book do not routinely include these comments since the surrounding text provides full explanation caution the equation line ( produces an incorrect result in python due to its implementation of integer divisionwhich is not the same as the mathematical definition by definitionthe result of the integer division - / is but python computes this as - resulting in - thuswe had to modify the first line of the equation to produce the correct julian day when the month component is greater than protected attributes and methods python does not provide technique to protect attributes and helper methods in order to prevent their use outside the class definition in this textwe use identifier nameswhich begin with single underscore to flag those attributes and methods that should be considered protected and rely on the user of the class to not attempt direct access the gregorian date to access the gregorian date components the julian day must be converted back to gregorian this conversion is needed in several of the adt operations instead of duplicating the formula each time it' neededwe create helper method to handle the conversion as illustrated in lines - of listing the togregorian(method returns tuple containing the daymonthand year components as with the conversion from gregorian to julianinteger arithmetic operations are used throughout the conversion formula by returning tuplewe can call the helper method and use the appropriate component from the tuple for the given gregorian component access methodas illustrated in lines - the dayofweek(methodshown in lines - also uses the togregorian(conversion helper method we determine the day of the week based on the gregorian components using simple formula that returns an integer value between and where represents monday represents tuesdayand so on the tostring operation defined by the adt is implemented in lines - by overloading python' str method it creates string representation of date in gregorian format this can be done using the string format operator and supplying the values returned from the conversion helper method by using python' str methodpython automatically calls this method on the object when you attempt to print or convert an object to string as in the following example