Get the latest tech news
Ovld – Efficient and featureful multiple dispatch for Python
Advanced multiple dispatch for Python functions. Contribute to breuleux/ovld development by creating an account on GitHub.
This means you can define one ovld that recursively walks generic data structures, and then specialize it in various ways. They may define additional overloads for these methods which will only be valid for the subclass, but they need to use the@extend_super decorator (this is required for clarity): ovld is pretty fast: the overhead is comparable to isinstance or match, and only 2-3x slower when dispatching on Literal types.
Or read this on Hacker News