advanced programming techniques sion any concrete methods or properties are available through inheritance as usual all abcs must have metaclass of abc abcmeta (from the abc module)or from one of its subclasses we cover metaclasses bit further on metaclasses python provides two groups of abstract base classesone in the collections module and the other in the numbers module they allow us to ask questions about an objectfor examplegiven variable xwe can see whether it is sequence using isinstance(xcollections mutablesequenceor whether it is whole number using isinstance(xnumbers integralthis is particularly useful in view of python' dynamic typing where we don' necessarily know (or carewhat an object' type isbut want to know whether it supports the operations we want to apply to it the numeric and collection abcs are listed in tables and the other major abc is io iobase from which all the file and stream-handling classes derive to fully integrate our own custom numeric and collection classes we ought to make them fit in with the standard abcs for examplethe sortedlist class is sequencebut as it standsisinstance(lcollections sequencereturns false if is sortedlist one easy way to fix this is to inherit the relevant abcclass sortedlist(collections sequence)by making collections sequence the base classthe isinstance(test will now return true furthermorewe will be required to implement __init__((or __new__())__getitem__()and __len__((which we dothe collections sequence abc also provides concrete ( nonabstractimplementations for __contains__()__iter__()__reversed__()count()and index(in the case of sortedlistwe reimplement them allbut we could have used the abc versions if we wanted tosimply by not reimplementing them we cannot make sortedlist subclass of collections mutablesequence even though the list is mutable because sortedlist does not have all the methods that collections mutablesequence must providesuch as __setitem__(and append((the code for this sortedlist is in sortedlistabc py we will see an alternative approach to making sortedlist into collections sequence in the metaclasses subsection now that we have seen how to make custom class fit in with the standard abcswe will turn to another use of abcsto provide an interface promise for our own custom classes we will look at three rather different examples to cover different aspects of creating and using abcs we will start with very simple example that shows how to handle readable/writable properties the class is used to represent domestic appliances every appliance that is created must have read-only model string and readable/writable price we also want to ensure that the abc' __init__(is reimplemented here' the abc (from appliance py)we have not shown the import metaclasses