Like functools.singledispatch, but will allow to register multiple functions for each class.
If a registered function decides it cannot handle the value after inspecting it, it can give up and let others try their luck:
from allot import allot, Pass
@allot
def f(obj):
return 'object'
@f.register(int)
def f_small_integer(obj):
if obj > 10:
return Pass
return 'small integer'
assert f('a string') == 'object'
assert f(3) == 'small integer'
assert f(10) == 'object'
Metadata
Release files for allot 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| allot-0.2.tar.gz | 18.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| allot-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.1 kB
Release files / allot-0.2.tar.gz
| Download URL | allot-0.2.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e607c8860705a5cdc6bbd523470840e938ca5e1f1ac4daac64974483994433b6
|
|
BLAKE2b-256 checksum How to use checksums |
3388a0a075c987fba56a00fdb6f14e05278d78954b3fd0689a24c11bd3b8b555
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.21.0
|
Release files / allot-0.2-py3-none-any.whl
| Download URL | allot-0.2-py3-none-any.whl |
|---|---|
| Size | 38.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8393ea1257abceb4399ea398dad4385317f06647004617c6a42ea315ed127e3
|
|
BLAKE2b-256 checksum How to use checksums |
28605624bc69d5abae599c79d8a019f7e94fdbaa4cb893b5c45308fb44bd99a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.21.0
|