{"library":"overloading","title":"Overloading","description":"Overloading.py is a Python 3 library that provides function and method dispatching based on the types and number of runtime arguments. When an overloaded function is called, it compares the arguments supplied to available signatures and invokes the implementation that provides the most accurate match. The library's current version is 0.5.0, released in April 2016, suggesting a low or inactive release cadence.","language":"python","status":"abandoned","last_verified":"Thu Apr 16","install":{"commands":["pip install overloading","pip install typing"],"cli":null},"imports":["from overloading import overload"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from collections.abc import Iterable\nfrom overloading import overload\n\n@overload\ndef biggest(items: Iterable[int]):\n    return max(items)\n\n@overload\ndef biggest(items: Iterable[str]):\n    return max(items, key=len)\n\nprint(biggest([2, 0, 15, 8, 7]))\nprint(biggest(['a', 'abc', 'bc']))\n","lang":"python","description":"This example demonstrates how to define multiple implementations of a function `biggest` using the `@overload` decorator. The library automatically dispatches to the correct implementation based on the runtime type of the `items` argument.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}