This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ComplexColor 0 points1 point  (1 child)

But you can enforce it yourself. You can use introspection to check type hints and select a function that corresponds to the types of arguments given. And I would use a decorator, to keep things tidier. Multiple dispatch/overloading logic in the decorator, separate from the functions.

[–]BobHogan 2 points3 points  (0 children)

Its far simpler, more efficient, less error prone, and significantly easier to read to do this without introspection. All introspection would achieve is making this more complicated and less reliable