Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Python 2.7
- In [1]: def get_list_of_tuples():
- ....: return [(i,) for i in range(10**6)]
- ....:
- In [2]: import dis
- In [3]: dis.dis(get_list_of_tuples)
- 2 0 BUILD_LIST 0
- 3 LOAD_GLOBAL 0 (range)
- 6 LOAD_CONST 3 (1000000)
- 9 CALL_FUNCTION 1
- 12 GET_ITER
- >> 13 FOR_ITER 15 (to 31)
- 16 STORE_FAST 0 (i)
- 19 LOAD_FAST 0 (i)
- 22 BUILD_TUPLE 1
- 25 LIST_APPEND 2
- 28 JUMP_ABSOLUTE 13
- >> 31 RETURN_VALUE
- #Python 2.6
- 2 0 BUILD_LIST 0
- 3 DUP_TOP
- 4 STORE_FAST 0 (_[1])
- 7 LOAD_GLOBAL 0 (range)
- 10 LOAD_CONST 3 (1000000)
- 13 CALL_FUNCTION 1
- 16 GET_ITER
- >> 17 FOR_ITER 16 (to 36)
- 20 STORE_FAST 1 (i)
- 23 LOAD_FAST 0 (_[1])
- 26 LOAD_FAST 1 (i)
- 29 BUILD_TUPLE 1
- 32 LIST_APPEND
- 33 JUMP_ABSOLUTE 17
- >> 36 DELETE_FAST 0 (_[1])
- 39 RETURN_VALUE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement