Skip to main content

Function overloading for Python 3

Project description

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:

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

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


  • 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


The full documentation is available at

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for overloading, version 0.5.0
Filename, size File type Python version Upload date Hashes
Filename, size overloading-0.5.0.tar.gz (11.1 kB) File type Source Python version None Upload date Hashes View
Filename, size overloading-0.5.0-py3-none-any.whl (11.0 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page