'1') f(
'This is a string!'
Wrapper for plum dispatch to make it more compatible with fastcore’s typedispatch. Hopefully this is just temporary, and instead the functionality here will be moved into plum.
pip install fastdispatch
fastdispatch
works just like plum, with a few extensions. We recommend reading through their very informative docs, however, here’s a quick example to get started:
Decorate type annotated Python functions with fastdispatch.dispatch
to add them as methods to a dispatched function (following Julia’s terminology):
@dispatch
def f(x: str): return "This is a string!"
@dispatch
def f(x: int): return "This is an integer!"
If there’s no matching method, plum.NotFoundLookupError
is raised: