Skip to content

Instantly share code, notes, and snippets.

@MaxDefense
Created March 15, 2023 13:50
Show Gist options
  • Save MaxDefense/404e25bdb5f06e1b3331717f0562ae9d to your computer and use it in GitHub Desktop.
Save MaxDefense/404e25bdb5f06e1b3331717f0562ae9d to your computer and use it in GitHub Desktop.
Callback a function with arguments in python 3.8.10
#! callback - function transmitted as a parameter of another function
# // def first(x):
# // print('- first function works')
# // x()
def first(x, *args):
print('- first function works')
x(*args)
def second():
print('- second function works')
# first(second)
def third(*args):
print(f'- result of the third function: {sum(args)}')
# first(third, 2, 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment