Skip to content

Instantly share code, notes, and snippets.

@somma
Created September 19, 2014 05:31
Show Gist options
  • Save somma/69c15c0f7043d4fc696d to your computer and use it in GitHub Desktop.
Save somma/69c15c0f7043d4fc696d to your computer and use it in GitHub Desktop.
callback function in python
#! /usr/bin/python3.2
def repeat (function, params, times):
for calls in range (times):
function (*params)
def foo (a, b):
print ('{} are {}'.format (a, b) )
repeat (foo, ['roses', 'red'], 4)
repeat (foo, ['violets', 'blue'], 4)
http://stackoverflow.com/questions/13783211/python-how-to-pass-an-argument-to-a-function-pointer-parameter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment