Hacker News new | ask | show | jobs
by ghj 2114 days ago
I didn't know about functools.singledispatch/singledispatchmethod, it looks really nice!

For typing hinting, I've been annotating with @overload which is just god awful ugly. And you still need to switch based on instance type for the actual implementation.

I will try this way instead!

[1] https://www.python.org/dev/peps/pep-0484/#function-method-ov...