Skip to content

Instantly share code, notes, and snippets.

@lyxal
Created July 4, 2021 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyxal/bcff84358830ce703b6c823ee796803b to your computer and use it in GitHub Desktop.
Save lyxal/bcff84358830ce703b6c823ee796803b to your computer and use it in GitHub Desktop.
def function_name(lhs, rhs):
# Only change the parameter names if absolutely neccesary
ts = VY_type(lhs, rhs)
return {
(number, number): lambda: stuff_with_lhs_and_rhs,
(number, str): lambda: more_stuff_with_lhs_and_rhs,
(str, number): lambda: even_more_stuff_with_lhs_and_rhs,
(str, str): lambda: double_string_overload_idk,
(any_other, type_overload_combination): lambda: whatever
}.get(ts, lambda: vectorise(function_name, lhs, rhs))()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment