Skip to content

Instantly share code, notes, and snippets.

@nadar71
Created February 15, 2022 11:27
Show Gist options
  • Save nadar71/f5fb580f1217a17d2ae4382f9c9ea59f to your computer and use it in GitHub Desktop.
Save nadar71/f5fb580f1217a17d2ae4382f9c9ea59f to your computer and use it in GitHub Desktop.
Callback example in Python, with parameters
def get_square(val):
"""The callback."""
return val ** 2
def caller(func, val):
return func(val)
caller(get_square, 5)
print caller(get_square, 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment