Created
July 21, 2012 21:45
-
-
Save akaptur/3157304 to your computer and use it in GitHub Desktop.
functions are objects
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 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