Created
October 24, 2020 10:11
-
-
Save akihironitta/2a45b095310643c25fb8cb32ddd00844 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 func1(): | |
return {"x": 0, "y": 1} | |
def func2(): | |
return dict(x=0, y=1) | |
dis.dis(func1) | |
dis.dis(func2) | |
# Output: | |
# -------------------------------------------------------- | |
# 4 0 LOAD_CONST 1 (0) | |
# 2 LOAD_CONST 2 (1) | |
# 4 LOAD_CONST 3 (('x', 'y')) | |
# 6 BUILD_CONST_KEY_MAP 2 | |
# 8 RETURN_VALUE | |
# 7 0 LOAD_GLOBAL 0 (dict) | |
# 2 LOAD_CONST 1 (0) | |
# 4 LOAD_CONST 2 (1) | |
# 6 LOAD_CONST 3 (('x', 'y')) | |
# 8 CALL_FUNCTION_KW 2 | |
# 10 RETURN_VALUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment