Loading topic
try/except. Here you will create an abstract base class (ABC), see what ABC and ABCMeta each do, and learn which mistakes beginners usually make.3 min readABC used as a base class. Here you will see what @abstractmethod records, how a subclass satisfies it, and where it silently does nothing.3 min read@abstractmethod decorator from the previous chapter, and can handle exceptions with try/except.2 min read@abstractmethod on a base class, and know that instantiating an incomplete subclass raises TypeError.2 min read@property, basic decorators, and how @abstractmethod blocks instantiation of incomplete subclasses.2 min read@classmethod, @staticmethod and @property work, and that you have used @abstractmethod on ordinary methods. Earlier chapters showed that Python refuses to instantiate a class that still has abstract methods. The same rule applies to class methods and static 2 min readtry/except works, and have seen @abstractmethod on a base class. Here you will see how isinstance and issubclass behave when the second argument is an abstract base class (ABC), and where those checks can mislead you.2 min read@abstractmethod blocks instantiation, and have seen isinstance with ABCs. Here you will use the ready-made ABCs in collections.abc to build container classes with little code.2 min readABC and @abstractmethod work, and that isinstance and issubclass accept ABCs. It also assumes you are comfortable with decorators.2 min readisinstance and issubclass work with ABCs and how register creates virtual subclasses. It also assumes you can read classmethods and decorators.2 min read@abstractmethod, know how isinstance and register work with ABCs, and have seen type hints. Both tools describe an interface. They differ in who has to know about that interface and when a mismatch is caught.2 min read@abstractmethod with ABC, and read a try/except block. It covers where abstract base classes (ABCs) fail to protect you, and how to design with them.2 min read