Skip to content

Instantly share code, notes, and snippets.

@satiani
Created April 5, 2014 03:44
Show Gist options
  • Save satiani/9987221 to your computer and use it in GitHub Desktop.
Save satiani/9987221 to your computer and use it in GitHub Desktop.
def a():
try:
return True
finally:
return False
print "The result of the function is: %s" % a()
print
print "The disassembly is:"
import dis
dis.dis(a)
=================
The result of the function is: False
The disassembly is:
2 0 SETUP_FINALLY 8 (to 11)
3 3 LOAD_GLOBAL 0 (True)
6 RETURN_VALUE
7 POP_BLOCK
8 LOAD_CONST 0 (None)
5 >> 11 LOAD_GLOBAL 1 (False)
14 RETURN_VALUE
15 END_FINALLY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment