(truefalseequivalentsame objectherel and are assigned lists that are equivalent but distinct objects as review of what we saw in because of the nature of python referencesthere are two ways to test for equalitythe =operator tests value equivalence python performs an equivalence testcomparing all nested objects recursively the is operator tests object identity python tests whether the two are really the same object ( live at the same address in memoryin the preceding examplel and pass the =test (they have equivalent values because all their components are equivalentbut fail the is check (they reference two different objectsand hence two different pieces of memorynotice what happens for short stringsthoughs 'spams 'spams = is (truetrueherewe should again have two distinct objects that happen to have the same value=should be trueand is should be false but because python internally caches and reuses some strings as an optimizationthere really is just single string 'spamin memoryshared by and hencethe is identity test reports true result to trigger the normal behaviorwe need to use longer stringss ' longer strings ' longer strings = is (truefalseof coursebecause strings are immutablethe object caching mechanism is irrelevant to your code--strings can' be changed in placeregardless of how many variables refer to them if identity tests seem confusingsee for refresher on object reference concepts as rule of thumbthe =operator is what you will want to use for almost all equality checksis is reserved for highly specialized roles we'll see cases later in the book where both operators are put to use relative magnitude comparisons are also applied recursively to nested data structuresl [ (' ' ) [ (' ' ) (falsefalsetruelessequalgreatertuple of results herel is greater than because the nested is greater than by now you should know that the result of the last line is really tuple of three objects--the results of the three expressions typed (an example of tuple without its enclosing parenthesescore types review and summary