Add function overloading to Python
Project description
Python Function Overload
A function decorator that allows for real function overloading in Python 3. Not
that typing.overload nonsense, but actual function overloading.
This module is a joke, please don't use it in production code.
Installation
You can install either install this module from the source or from PyPI using
pip install function-overload
Usage
Overload-decorated function are grouped by name. The name of the group is
determined either by the name of the decorated function or by the name
argument to the overload decorator.
When a overloaded function is called, the arguments are matched against the signatures of the functions in the group. The first function whose signature matches the arguments is called (in the order they were defined).
from overload import overload
@overload
def foo(x: int):
return x + 1
@overload
def foo(x: str):
return x + '!'
assert foo(1) == 2
assert foo('hello') == 'hello!'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file function_overload-0.1.0.tar.gz.
File metadata
- Download URL: function_overload-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ddae02ee8d909ac4a5ba271c8fcf62ae4c18693f2833b886df25b66bc028d81
|
|
| MD5 |
43a7cc1f8b6199c6a3934da5bd3f7ac4
|
|
| BLAKE2b-256 |
4097c3ec50a4f8389f0c6b6693902df96b00eda02d7a40b68eed9c9eceea99fa
|
Provenance
The following attestation bundles were made for function_overload-0.1.0.tar.gz:
Publisher:
python-publish.yml on giulioprocopio/python-overload
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
function_overload-0.1.0.tar.gz -
Subject digest:
0ddae02ee8d909ac4a5ba271c8fcf62ae4c18693f2833b886df25b66bc028d81 - Sigstore transparency entry: 1369413899
- Sigstore integration time:
-
Permalink:
giulioprocopio/python-overload@919e98373dbdf798223de728aba1f47e8ee04513 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/giulioprocopio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@919e98373dbdf798223de728aba1f47e8ee04513 -
Trigger Event:
release
-
Statement type:
File details
Details for the file function_overload-0.1.0-py3-none-any.whl.
File metadata
- Download URL: function_overload-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
274954b9ffc03f259e867b81f0c03a8e97191983642d13977f06db447b36abd7
|
|
| MD5 |
ae7f6e9e32385b18299857dc03ac00ec
|
|
| BLAKE2b-256 |
d729ea303395b184db70fff80e212cc9af2d071657ee317aa83bcdd92ac4aecd
|
Provenance
The following attestation bundles were made for function_overload-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on giulioprocopio/python-overload
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
function_overload-0.1.0-py3-none-any.whl -
Subject digest:
274954b9ffc03f259e867b81f0c03a8e97191983642d13977f06db447b36abd7 - Sigstore transparency entry: 1369413981
- Sigstore integration time:
-
Permalink:
giulioprocopio/python-overload@919e98373dbdf798223de728aba1f47e8ee04513 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/giulioprocopio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@919e98373dbdf798223de728aba1f47e8ee04513 -
Trigger Event:
release
-
Statement type: