Loading topic
super() in detail.5 min readself, and read simple f-strings. You should also know what a subclass is. Here you will learn the exact search Python runs when you write obj.name. That search explains inheritance, shadowing, and several common bugs.5 min readself. It also assumes you have seen a subclass written as class Dog(Animal):. It covers how a subclass replaces inherited behavior and what happens when you do. It also covers the mistakes that cause bugs. 5 min readself, and have read the earlier chapters on subclassing and overriding. You should know that a subclass method with the same name as a parent method replaces it for instances of the subclass.5 min read__init__. It also assumes you have seen super() used to call a parent method. You should be comfortable with default arguments and with *args and `**kwar5 min readself, override a method in a subclass, call super(), and use isinstance(). It builds on those to show how overriding lets one piece of code work with many kinds of objects.5 min readsuper(). It also assumes you know what polymorphism means: calling one method name on objects of different subclasses. Here you will learn how to make Python enforce the rule that a subclass must provide certai6 min readsuper() in a simple hierarchy. It builds on attribute lookup and super() from earlier chapters. Here you will learn to read the order Python searches classes, predict which method runs, and spot hierarchies Pyt5 min readsuper() in a method, and read a class's __mro__ (method resolution order). If any of those feel shaky, review the earlier chapters on super() and the method resolution order first.6 min readsuper(), and read a method resolution order (MRO) from __mro__. It builds on those to show how a mixin adds one narrow behavior to many unrelated classes.5 min readsuper(). It covers how to override a method so that code written for the parent class keeps working with the subclass.5 min readsuper(), and read a method resolution order (MRO). It builds on the earlier chapters on substitutability and mixins. Here you learn to decide when a class should extend another class and when it should hold another object instead.5 min read