Created
August 30, 2011 09:41
-
-
Save svetlyak40wt/1180555 to your computer and use it in GitHub Desktop.
Python callbacks
This file contains 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 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