Skip to content

Instantly share code, notes, and snippets.

@akaptur
Created July 21, 2012 21:45
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 akaptur/3157304 to your computer and use it in GitHub Desktop.
Save akaptur/3157304 to your computer and use it in GitHub Desktop.
functions are objects
def getTalk(volume='shout'):
def whisper(word='hello'):
return word.lower()+'...'
def shout(word='hello'):
return word.capitalize()+"!"
if volume == 'shout' : # reference function without calling it
return shout
else:
return whisper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment