Created
February 15, 2022 11:27
-
-
Save nadar71/f5fb580f1217a17d2ae4382f9c9ea59f to your computer and use it in GitHub Desktop.
Callback example in Python, with parameters
This file contains hidden or 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
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