Skip to main content

overloading is a module that provides function and method dispatching based on the types and number of runtime arguments.

When an overloaded function is invoked, the dispatcher compares the supplied arguments to available signatures and calls the implementation providing the most accurate match:

@overload
def biggest(items: Iterable[int]):
    return max(items)

@overload
def biggest(items: Iterable[str]):
    return max(items, key=len)
>>> biggest([2, 0, 15, 8, 7])
15
>>> biggest(['a', 'abc', 'bc'])
'abc'

Features

  • Function validation during registration and comprehensive resolution rules guarantee a well-defined outcome at invocation time.

  • Supports the typing module introduced in Python 3.5.

  • Supports optional parameters.

  • Supports variadic signatures (*args and **kwargs).

  • Supports class-/staticmethods.

  • Evaluates both positional and keyword arguments.

  • No dependencies beyond the standard library

Documentation

The full documentation is available at https://overloading.readthedocs.org/.

Metadata

Release files for overloading 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for overloading 0.5.0
File Size Uploaded
overloading-0.5.0.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for overloading 0.5.0
File Interpreter ABI Platform
overloading-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.1 kB

Release files / overloading-0.5.0.tar.gz

Download URL overloading-0.5.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
493f0f67211244ed6bf2acf9f3ac61fb38e8aa87834c4f0f84d8943512066588
BLAKE2b-256 checksum
How to use checksums
196cdbc5ddff9eec6b57046c11985d28ebac2f8073596a7cc903c76f26856284
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / overloading-0.5.0-py3-none-any.whl

Download URL overloading-0.5.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c28d2a227cfb6bdefcfe0ded055bc620a5c784a52ecadc441f8d6c281b8bb1c1
BLAKE2b-256 checksum
How to use checksums
3bd1775dec1fb1e2a600d587adfef9aafba7b0b995532b3bc63a5a927446a8ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.3

1 release file

0.2.2

0.2.1

0.2.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page