__export_xpm(method because it isn' really relevant to this themebut it is in the book' source codeof course we have now completed our coverage of the custom image class this class is typical of those used to hold program-specific dataproviding access to the data items it containsthe ability to save and load all its data to and from diskand with only the essential methods it needs provided in the next two subsections we will see how to create two generic custom collection types that offer complete apis creating collection classes using aggregation |in this subsection we will develop complete custom collection data typesortedlistthat holds list of items in sorted order the items are sorted using their less than operator (<)provided by the __lt__(special methodor by using key function if one is given the class tries to match the api of the builtin list class to make it as easy to learn and use as possiblebut some methods cannot sensibly be provided--for exampleusing the concatenation operator (+could result in items being out of orderso we do not implement it as always when creating custom classeswe are faced with the choices of inheriting class that is similar to the one we want to makeor creating class from scratch and aggregating instances of any other classes we need inside itor doing mixture of both for this subsection' sortedlist we use aggregation (and implicitly inherit objectof course)and for the following subsection' sorteddict we will use both aggregation and inheritance (inheriting dictin we will see that classes can make promises about the api they offer for examplea list provides the mutablesequence api which means that it supports the in operatorthe iter(and len(built-in functionsand the item access operator ([]for gettingsettingand deleting itemsand an insert(method the sortedlist class implemented here does not support item setting and does not have an insert(methodso it does not provide mutablesequence api if we were to create sortedlist by inheriting listthe resultant class would claim to be mutable sequence but would not have the complete api in view of this the sortedlist does not inherit list and so makes no promises about its api on the other handthe next subsection' sorteddict class supports the complete mutablemapping api that the dict class providesso we can make it dict subclass here are some basic examples of using sortedlistletters sortedlist sortedlist((" "" "" "" "" ")str lowerstr(letters="[' '' '' '' '' ']letters add(" "letters add(" "letters add(" "