Skip to content

Instantly share code, notes, and snippets.

@arian-f
Created June 18, 2022 19:59
Show Gist options
  • Save arian-f/17119110e26eba7bf5512ced51503304 to your computer and use it in GitHub Desktop.
Save arian-f/17119110e26eba7bf5512ced51503304 to your computer and use it in GitHub Desktop.
def double(x: int) -> int:
return x * 2
def add(x: int, y: int) -> int:
return x + y
def doubleAndAdd(x: int, y: int) -> None:
steps = (
(double, (x,)),
(add, (x, y)),
)
for func, args in steps:
func(*args) # error: Cannot call function of unknown type
def doubleTwice(x: int, y: int) -> None:
steps = (
(double, (x, )),
(double, (y, )),
)
for func, args in steps:
func(*args) # passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment