Golden Codes - armanexplorer planet

Practical code snippets for Django, Python, Bash, Git and All!

View on GitHub

Link1

something

from multipledispatch import dispatch

@dispatch(int, int)
def add(x, y):
    return x + y

@dispatch(float, float)
def add(x, y):
    return x + y

result1 = add(2, 3)  # Calls add(int, int)
result2 = add(2.5, 3.1)  # Calls add(float, float)