{"categories":[{"label":"Software Development","url":"https://skillfed.io/packages/category/software-development/4"}],"enrichment":{"capability":"Provides single-dispatch generic functions\u2014a decorator-based mechanism to define functions that behave differently based on the type of their first argument\u2014backported from Python 3.4's functools module for use on older Python versions.","skillfed_tags":["generic-functions","decorator","backport"],"use_cases":["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."],"what_it_does":"singledispatch is a backport of Python's functools.singledispatch decorator, which implements single-dispatch generic functions\u2014a 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.\n\nThis 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.","worth_installing":"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."},"id":"singledispatch","links":{"html":"https://skillfed.io/packages/singledispatch","md":"https://skillfed.io/packages/singledispatch.md","pypi":"https://pypi.org/project/singledispatch/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2025-05-14","license_spdx":"MIT","license_treatment":"permissive","name":"singledispatch","python_support":"supports_current","summary":"Backport functools.singledispatch to older Pythons."},"popularity":{"monthly_downloads":2001134,"position":3372,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"4.1.2"}
