Created
August 1, 2017 07:54
-
-
Save moskomule/0ec708c0f5560406c85e5e077defbe01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import singledispatch | |
import numpy as np | |
@singledispatch | |
def test_function(arg): | |
print("default") | |
@test_function.register(int) | |
def _(arg): | |
print(f"arg is integer {arg}") | |
@test_function.register(str) | |
def _(arg): | |
print(f"arg is string {arg}") | |
@test_function.register(np.ndarray) | |
def _(arg): | |
print(f"arg is ndarray {arg}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment