Skip to content

Instantly share code, notes, and snippets.

@swshan
Created August 1, 2017 03:35
Show Gist options
  • Save swshan/7e48a15965f9f74845df7935d3163e5f to your computer and use it in GitHub Desktop.
Save swshan/7e48a15965f9f74845df7935d3163e5f to your computer and use it in GitHub Desktop.
回调函数 demo
#coding=utf-8
def double(x):
return x*2
def getoddnum(k, getEvenNumber):
return 1 + getEvenNumber(k)
def main():
k = 1
i = getoddnum(k, double) # 2k+1
print (i)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment