Single Dispatch
A mechanism for dispatching functions based on runtime types, implemented in Python through functools.singledispatch, which allows different implementations to be invoked according to the type of the first argument.
Timeline (last 90 days)
The single-dispatch approach requires no visitor object and no hand-written dictionary; dispatch is handled entirely by Python's internal mechanism, while also supporting recursive calls on child nodes.
Single dispatch is a polymorphism mechanism that decides which function implementation to call based on the actual type of one argument; by contrast, multiple dispatch selects an implementation based on the type combination of multiple arguments.
Compared with class inheritance, single dispatch does not require node classes to implement a specific interface or accept method, thereby decoupling nodes from operations while preserving type safety.
All Facts (3)
The single-dispatch approach requires no visitor object and no hand-written dictionary; dispatch is handled entirely by Python's internal mechanism, while also supporting recursive calls on child nodes.
50%UnverifiedSingle dispatch is a polymorphism mechanism that decides which function implementation to call based on the actual type of one argument; by contrast, multiple dispatch selects an implementation based on the type combination of multiple arguments.
50%UnverifiedCompared with class inheritance, single dispatch does not require node classes to implement a specific interface or accept method, thereby decoupling nodes from operations while preserving type safety.
50%