Skip to content

Instantly share code, notes, and snippets.

@ironfroggy
Created September 8, 2016 15:15
Show Gist options
  • Save ironfroggy/627a20fb5caf296ec0850e542350e8e7 to your computer and use it in GitHub Desktop.
Save ironfroggy/627a20fb5caf296ec0850e542350e8e7 to your computer and use it in GitHub Desktop.
>>> dis.dis(foo)
2 0 BUILD_LIST 0
3 STORE_FAST 0 (a)
3 6 LOAD_FAST 0 (a)
9 LOAD_CONST 1 ('bleh')
12 INPLACE_ADD
13 STORE_FAST 0 (a)
4 16 LOAD_FAST 0 (a)
19 LOAD_CONST 2 ('bluh')
22 INPLACE_ADD
23 STORE_FAST 0 (a)
5 26 LOAD_GLOBAL 0 (print)
29 LOAD_CONST 3 ('')
32 LOAD_ATTR 1 (join)
35 LOAD_FAST 0 (a)
38 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
41 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
44 POP_TOP
45 LOAD_CONST 0 (None)
48 RETURN_VALUE
>>> dis.dis(bar)
2 0 LOAD_CONST 1 ('')
3 STORE_FAST 0 (a)
3 6 LOAD_FAST 0 (a)
9 LOAD_CONST 2 ('bleh')
12 INPLACE_ADD
13 STORE_FAST 0 (a)
4 16 LOAD_FAST 0 (a)
19 LOAD_CONST 3 ('bluh')
22 INPLACE_ADD
23 STORE_FAST 0 (a)
5 26 LOAD_GLOBAL 0 (print)
29 LOAD_FAST 0 (a)
32 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
35 POP_TOP
36 LOAD_CONST 0 (None)
39 RETURN_VALUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment