liveBook · Manning

Dispatch table

A dispatch table is a mapping from operation or case identifiers to callable implementations selected and invoked at runtime.

How 2 Manning books explain it

Python Workout: 50 ten-minute exercises

A dispatch table is a mapping from keys representing operations or cases to callable implementations selected at runtime.

How it is used
Maps user-selected operators or menu options to functions without branching through a growing chain of conditionals.
How deep it goes
Explains dictionary-based lookup, input parsing, invocation, maxsplit, and dynamic **kwargs construction, but not deeper dispatch internals.
Examples
Uses a prefix calculator with arithmetic operators and a dynamically assembled zero-argument menu.
What you can do after
Build it from scratch using Python dictionaries to register callable handlers and route parsed input to them.

Read how Python Workout: 50 ten-minute exercises explains dispatch table →

Python Workout, Second Edition

A dispatch table is a mapping from selectable operation identifiers to callable implementations that can be looked up and invoked.

How it is used
Maps operator or menu identifiers to functions so input selects behavior without a growing if/elif chain.
How deep it goes
Explains hard-coded and dynamic tables, lookup-and-call syntax, input unpacking, and maxsplit, but not broader dispatch architecture.
Examples
Uses an arithmetic calculator and a zero-argument menu whose keyword arguments provide selectable functions.
What you can do after
Build calculator and menu dispatchers by registering functions, parsing selections, and invoking the selected callable.

Read how Python Workout, Second Edition explains dispatch table →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.