Polymorphism

Polymorphism, or dynamic binding, is handled entirely through the attribute lookup process described for inheritance in the preceding section.Whenever a method is accessed as obj .method (), method is located by searching the _ _dict_ _ attribute of the instance, the instance’s class definition, and base classes, in that order. The first match found is used as the method.

Get Python Essential Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.