extend by adding new external subclasses rather than changing existing logic in place the idea of redefining inherited names leads to variety of specialization techniques for instancesubclasses may replace inherited attributes completelyprovide attributes that superclass expects to findand extend superclass methods by calling back to the superclass from an overridden method we've already seen some of these patterns in actionhere' self-contained example of extension at workclass superdef method(self)print('in super method'class sub(super)def method(self)print('starting sub method'super method(selfprint('ending sub method'override method add actions here run default action direct superclass method calls are the crux of the matter here the sub class replaces super' method function with its own specialized versionbut within the replacementsub calls back to the version exported by super to carry out the default behavior in other wordssub method just extends super method' behaviorrather than replacing it completelyx super( method(in super method make super instance runs super method sub( method(starting sub method in super method ending sub method make sub instance runs sub methodcalls super method this extension coding pattern is also commonly used with constructorssee the section "methodson page for an example class interface techniques extension is only one way to interface with superclass the file shown in this sectionspecialize pydefines multiple classes that illustrate variety of common techniquessuper defines method function and delegate that expects an action in subclass inheritor doesn' provide any new namesso it gets everything defined in super replacer overrides super' method with version of its own inheritance