Multiple argument dispatching
Call multimethod on a variable number of types. It returns a decorator which finds the multimethod of the same name, creating it if necessary, and adds that function to it. For example:
@multimethod(*types)
def func(*args):
pass
func is now a multimethod which will delegate to the above function, when called with arguments of the specified types. If an exact match can’t be found, the next closest method is called (and cached). If strict is enabled, and there are multiple candidate methods, a TypeError is raised. A function can have more than one multimethod decorator.
See tests for more example usage. Supported on Python 2.6 or higher, including Python 3.
- Changes in 0.4:
Dispatch on python 3 annotations
Metadata
Release files for multimethod 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| multimethod-0.4.tar.gz | 3.7 kB | Details |
Release files / multimethod-0.4.tar.gz
| Download URL | multimethod-0.4.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30848df6a30cd904559430bfd001e97a385f4642d2bde1ca2ebf61c9582682ba
|
|
BLAKE2b-256 checksum How to use checksums |
50cedf57c06de38fc75f53548d96a62daafb9e84c4f82c1e2b682760ce0d20f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |