Skip to content

Instantly share code, notes, and snippets.

@svetlyak40wt
Created August 30, 2011 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svetlyak40wt/1180555 to your computer and use it in GitHub Desktop.
Save svetlyak40wt/1180555 to your computer and use it in GitHub Desktop.
Python callbacks
def foo(arg1, arg2):
print 'foo:', arg1, arg2
def bar(arg1, arg2):
print 'bar:', arg1, arg2
def main(callback):
callback('blah', 'minor')
if __name__ == '__main__':
# здесь в качестве калбека одну функцию передаем
main(foo)
# у тут — другую
main(bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment