Created
April 25, 2015 02:07
-
-
Save bcho/5139a48df255f1709918 to your computer and use it in GitHub Desktop.
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
import dis | |
def f(): | |
False is False is False | |
def f2(): | |
1 <= 1 <= 1 | |
print(dis.dis(f)) | |
# 0 LOAD_GLOBAL 0 (False) | |
# 3 LOAD_GLOBAL 0 (False) | |
# 6 DUP_TOP | |
# 7 ROT_THREE | |
# 8 COMPARE_OP 8 (is) | |
# 11 JUMP_IF_FALSE_OR_POP 23 | |
# 14 LOAD_GLOBAL 0 (False) | |
# 17 COMPARE_OP 8 (is) | |
# 20 JUMP_FORWARD 2 (to 25) | |
# >> 23 ROT_TWO | |
# 24 POP_TOP | |
# >> 25 POP_TOP | |
# 26 LOAD_CONST 0 (None) | |
# 29 RETURN_VALUE | |
print(dis.dis(f2)) | |
# 0 LOAD_CONST 1 (1) | |
# 3 LOAD_CONST 1 (1) | |
# 6 DUP_TOP | |
# 7 ROT_THREE | |
# 8 COMPARE_OP 1 (<=) | |
# 11 JUMP_IF_FALSE_OR_POP 23 | |
# 14 LOAD_CONST 1 (1) | |
# 17 COMPARE_OP 1 (<=) | |
# 20 JUMP_FORWARD 2 (to 25) | |
# >> 23 ROT_TWO | |
# 24 POP_TOP | |
# >> 25 POP_TOP | |
# 26 LOAD_CONST 0 (None) | |
# 29 RETURN_VALUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment