3 ms·
Singledispatch from functools will often work in a lot of situations where you might want to do something like this: https://docs.python.org/3/library/functools
by whalesalad 7y ago
Singledispatch from functools will often work in a lot of situations where you might want to do something like this: https://docs.python.org/3/library/functools.html https://docs.python.org/3/library/functools.html
This is a cool post from the author, though. I interpret this as more of an exploration of Python under the hood versus being a recommended production solution.
Python certainly could use a facility to do that based on an arbitrary predicate fn versus type comparison, though.
Python is well suited for this.. maybe it is time to throw a PEP in the ring.