extending built-ins one interesting use of this kind of inheritance is adding functionality to built-in classes in the contact class seen earlierwe are adding contacts to list of all contacts what if we also wanted to search that list by namewellwe could add method on the contact class to search itbut it feels like this method actually belongs to the list itself we can do this using inheritanceclass contactlist(list)def search(selfname)'''return all contacts that contain the search value in their name ''matching_contacts [for contact in selfif name in contact namematching_contacts append(contactreturn matching_contacts class contactall_contacts contactlist(def __init__(selfnameemail)self name name self email email self all_contacts append(selfinstead of instantiating normal list as our class variablewe create new contactlist class that extends the built-in list thenwe instantiate this subclass as our all_contacts list we can test the new search functionality as followsc contact("john ""johna@example net" contact("john ""johnb@example net" contact("jenna ""jennac@example net"[ name for in contact all_contacts search('john')['john ''john 'are you wondering how we changed the built-in syntax [into something we can inherit fromcreating an empty list with [is actually shorthand for creating an empty list using list()the two syntaxes behave identically[=list(true