erator ([]applied directly to selfsince self is dict if an out-of-range index is given the methods raise an indexerror exception we have now completed the implementation of the sorteddict class it is not often that we need to create complete generic collection classes like thisbut when we dopython' special methods allow us to fully integrate our class so that its users can treat it like any of the built-in or standard library classes summary ||this covered all the fundamentals of python' support for object-oriented programming we began by showing some of the disadvantages of purely procedural approach and how these could be avoided by using object orientation we then described some of the most common terminology used in objectoriented programmingincluding many "duplicateterms such as base class and super class we saw how to create simple classes with data attributes and custom methods we also saw how to inherit classes and how to add additional data attributes and additional methodsand how methods can be "unimplementedunimplementing is needed when we inherit class but want to restrict the methods that our subclass providesbut it should be used with care since it breaks the expectation that subclass can be used wherever one of its base classes can be usedthat isit breaks polymorphism custom classes can be seamlessly integrated so that they support the same syntaxes as python' built-in and library classes this is achieved by implementing special methods we saw how to implement special methods to support comparisonshow to provide representational and string formsand how to provide conversions to other types such as int and float when it makes sense to do so we also saw how to implement the __hash__(method to make custom class' instances usable as dictionary keys or as members of set data attributes by themselves provide no mechanism for ensuring that they are set to valid values we saw how easy it is to replace data attributes with properties--this allows us to create read-only propertiesand for writable properties makes it easy to provide validation most of the classes we create are "incompletesince we tend to provide only the methods that we actually need this works fine in pythonbut in addition it is possible to create complete custom classes that provide every relevant method we saw how to do this for single valued classesboth by using aggregation and more compactly by using inheritance we also saw how to do this for multivalued (collectionclasses custom collection classes can provide the same facilities as the built-in collection classesincluding support for inlen()iter()reversed()and the item access operator ([]