methoddispatch
singledispatch decorator for class methods.
Decision gist · record as of 2026-08-14
Yes, if you need independent dispatch tables in class hierarchies. The package solves a real limitation of functools.singledispatchmethod and has no dependencies. Dormant maintenance is acceptable here—the feature is stable and unlikely to need updates. Install it for polymorphic method dispatch; avoid it if you only need single-dispatch functions (use functools.singledispatch instead).AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with no runtime dependencies.
- Maintenance is dormant—last release was 2023-11-21 and no commits since then—but the package is stable and archived status is false, suggesting it is maintained as-is rather than abandoned.
License · maintenance · safety
BSD (permissive) — BSD license is permissive, allowing commercial and private use with minimal restrictions; suitable for most projects.
last release 2023-11-21 (997 days) · last repo commit 2023-11-21 · 5 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 98,377 downloads/mo, #13,088 on PyPI
Alternatives
Verify before relying
from methoddispatch import singledispatch, SingleDispatch
class MyClass(SingleDispatch):
@singledispatch
def process(self, arg):
print(arg)
@process.register(int)
def process_int(self, arg):
print(f"int: {arg}")
obj = MyClass()
obj.process(42) # dispatches to process_int- Whether the package works correctly with Python 3.12+ given the last release was 2023-11-21 and no explicit classifier for 3.12 is listed.
- Performance characteristics when dispatch registries grow large or when used in high-throughput scenarios.
What it is and what it does
methoddispatch extends Python's functools.singledispatchmethod to allow subclasses to maintain independent dispatch tables. The standard library's singledispatchmethod (added in Python 3.8) shares a dispatch registry across all subclasses, preventing subclasses from overriding type handlers without affecting the parent class. This package solves that by providing a SingleDispatch mixin that gives each class its own registry copy.
You decorate a method with @singledispatch and then register type-specific implementations using @method.register(type). When the method is called, it dispatches to the appropriate implementation based on the type of the first argument. Subclasses can extend or override the registry independently, and you can also register implementations at runtime via add_overload() or on individual instances. Type hints are supported for automatic type inference.
Use it for
- Implement polymorphic behavior in class hierarchies where different subclasses need different type handlers without modifying parent dispatch tables.
- Create generic data processors that handle multiple input types (int, str, list, etc.) with specialized logic for each.
- Build plugin or strategy systems where handlers are registered by type and subclasses can add their own type handlers.
- Write serializers or formatters that dispatch on object type to produce different output representations.
- Develop type-aware method resolution in domain models where behavior depends on argument type rather than method name.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need independent dispatch tables in class hierarchies.
The package solves a real limitation of functools.singledispatchmethod and has no dependencies. Dormant maintenance is acceptable here—the feature is stable and unlikely to need updates. Install it for polymorphic method dispatch; avoid it if you only need single-dispatch functions (use functools.singledispatch instead).
Install
methoddispatch on PyPI
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2023-11-21 and no commits since then—but the package is stable and archived status is false, suggesting it is maintained as-is rather than abandoned.
License in practice
BSD license is permissive, allowing commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
from methoddispatch import singledispatch, SingleDispatch
class MyClass(SingleDispatch):
@singledispatch
def process(self, arg):
print(arg)
@process.register(int)
def process_int(self, arg):
print(f"int: {arg}")
obj = MyClass()
obj.process(42) # dispatches to process_int
Verify before relying
- Whether the package works correctly with Python 3.12+ given the last release was 2023-11-21 and no explicit classifier for 3.12 is listed.
- Performance characteristics when dispatch registries grow large or when used in high-throughput scenarios.
Package facts
| License | BSD permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 997 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 98,377 / month, #13,088 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: methoddispatch-5.0.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “single dispatch decorator methods”
- methoddispatchAdds single-dispatch method support to Python classes, allowing…
- simplegenericProvides a lightweight decorator-based system for defining…
- singledispatchProvides single-dispatch generic functions—a decorator-based…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also singledispatch · multimethod · multipledispatch · overloading · pyvers · classes · json-encoder · decorator · ovld · overrides