abstract data types firstday date printfirstday comparing date objects we can logically compare two date instances to determine their calendar order when using julian day to represent the datesthe date comparison is as simple as comparing the two integer values and returning the appropriate boolean value based on the result of that comparison the "comparableadt operation is implemented using python' logical comparison operators as shown in lines - of listing by implementing the methods for the logical comparison operatorsinstances of the class become comparable objects that isthe objects can be compared against each other to produce logical ordering you will notice that we implemented only three of the logical comparison operators the reason for this is that starting with python version python will automatically swap the operands and call the appropriate reflective method when necessary for exampleif we use the expression with date objects in our programpython will automatically swap the operands and call instead since the lt method is defined but not gt it will do the same for > and < when testing for equalitypython will automatically invert the result when only one of the equality operators (=or !=is defined thuswe need only define one operator from each of the following pairs to achieve the full range of logical comparisons=and =or !for more information on overloading operatorsrefer to appendix tip overloading operators user-defined classes can implement methods to define many of the standard python operators such as +*%and ==as well as the standard named operators such as in and not in this allows for more natural use of the objects instead of having to call specific named methods it can be tempting to define operators for every class you createbut you should limit the definition of operator methods for classes where the specific operator has meaningful purpose bags the date adt provided an example of simple abstract data type to illustrate the design and implementation of complex abstract data typewe define the bag adt bag is simple container like shopping bag that can be used to store collection of items the bag container restricts access to the individual items by only defining operations for adding and removing individual itemsfor determining if an item is in the bagand for traversing over the collection of items