singledispatch
Backport functools.singledispatch to older Pythons.
Decision gist · record as of 2026-08-14
Yes, if you need single-dispatch functionality on Python versions before 3.4 or want the latest backport enhancements. No, if you're on Python 3.4+ and can use functools.singledispatch directly from the standard library. The package is stable, well-maintained, has no known vulnerabilities, and carries no license friction.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low install friction; pure Python wheel with no runtime dependencies.
- Actively maintained by a CPython core team member with recent commits as of 2026-04-13.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
last release 2025-05-14 (457 days) · last repo commit 2026-04-13 · 5 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,001,134 downloads/mo, #3,372 on PyPI
Alternatives
Verify before relying
pip install singledispatch
from singledispatch import singledispatch
@singledispatch
def process(arg):
print(f"Default: {arg}")
@process.register(int)
def _(arg):
print(f"Integer: {arg}")
process(arg)What it is and what it does
singledispatch is a backport of Python's functools.singledispatch decorator, which implements single-dispatch generic functions—a lightweight form of function overloading based on the type of the first argument. When you decorate a function with @singledispatch, you can register specialized implementations for specific types using the .register() method; at runtime, the dispatcher automatically calls the appropriate implementation based on the argument's type, falling back to the base implementation for unregistered types.
This is useful when you want to write cleaner, more maintainable code that handles multiple types without nested if-elif chains or isinstance checks scattered throughout. The backport allows you to use this functionality consistently across Python versions, and it also includes singledispatchmethod for class methods. Since the standard library version is built-in to Python 3.4+, this package is most valuable for codebases that need to support older Python versions or for projects that want to stay synchronized with the latest backport enhancements.
Use it for
- Implement type-specific behavior in a library without explicit type checking or if-elif chains.
- Create a plugin system where different types are handled by different registered handlers.
- Build serializers or formatters that need different logic for different types.
- Simplify mathematical or data-processing functions that operate on multiple numeric types.
- Define class methods that dispatch on argument type in object-oriented designs.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need single-dispatch functionality on Python versions before 3.4 or want the latest backport enhancements.
No, if you're on Python 3.4+ and can use functools.singledispatch directly from the standard library. The package is stable, well-maintained, has no known vulnerabilities, and carries no license friction.
Install
singledispatch on PyPI
Before you install
Low install friction; pure Python wheel with no runtime dependencies. Actively maintained by a CPython core team member with recent commits as of 2026-04-13.
Requires Python 3.9 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
Quickstart
pip install singledispatch
from singledispatch import singledispatch
@singledispatch
def process(arg):
print(f"Default: {arg}")
@process.register(int)
def _(arg):
print(f"Integer: {arg}")
process(arg)
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 457 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,001,134 / month, #3,372 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: Only |
Evidence: singledispatch-4.1.2-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”
- singledispatchProvides single-dispatch generic functions—a decorator-based…
- methoddispatchAdds single-dispatch method support to Python classes, allowing…
- simplegenericProvides a lightweight decorator-based system for defining…
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 methoddispatch · multipledispatch · simplegeneric · multimethod · pyvers · ovld · backports.functools-lru-cache · functools32 · classes · pyeventsystem