Skip to main content
# dispatk

## Description

This function is inspired by singledispatch of Python 3.4+ (PEP 443),
but the dispatch happens on the key extracted fro the arguments values.

```
from dispatk import dispatk

@dispatk(lambda n: int(n))
def fib(n):
return fib(n-1) + fib(n-2)
@fib.register(0)
def _(n):
return 0
@fib.register(1, 2)
def _(n):
return 1
@fib.register(41)
def _(n):
return 165580141
```

*register* accepts one or more keys, so

```
@fib.register(1, 2)
def _(n):
return 1
```

is equivalent to

```
@fib.register(1)
@fib.register(2)
def _(n):
return 1
```

Release files for dispatk 0.1

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

Built distribution (wheel)

Table of built distributions (wheels) for dispatk 0.1
File Interpreter ABI Platform
dispatk-0.1-py2.7.egg Legacy Egg format - - Details

Release files / dispatk-0.1-py2.7.egg

Download URL dispatk-0.1-py2.7.egg
Size 3.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
be4b912cba8cc968c43228a6b58ae88896b4afa703e03165b62ec55e4a2cbedf
BLAKE2b-256 checksum
How to use checksums
d47b24e24ed021a09e61826057bc56013fb1a4532bc883851e36b4531f8f4ab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

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