Skip to content

Instantly share code, notes, and snippets.

@agrif
Created September 23, 2012 03:05
Show Gist options
  • Save agrif/3768670 to your computer and use it in GitHub Desktop.
Save agrif/3768670 to your computer and use it in GitHub Desktop.
# normal use of return
def func1():
return(1)
print func1() # prints '1'
# freaky use of return
stored_return = None
def func2():
global stored_return
stored_return = return
# now return normally
return(False)
val = func2()
print val # prints 'False'
if not val:
stored_return(True) # prints 'True'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment