Advertisement
Guest User

Untitled

a guest
Dec 24th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. # Python 2.7
  2. In [1]: def get_list_of_tuples():
  3. ....: return [(i,) for i in range(10**6)]
  4. ....:
  5. In [2]: import dis
  6. In [3]: dis.dis(get_list_of_tuples)
  7. 2 0 BUILD_LIST 0
  8. 3 LOAD_GLOBAL 0 (range)
  9. 6 LOAD_CONST 3 (1000000)
  10. 9 CALL_FUNCTION 1
  11. 12 GET_ITER
  12. >> 13 FOR_ITER 15 (to 31)
  13. 16 STORE_FAST 0 (i)
  14. 19 LOAD_FAST 0 (i)
  15. 22 BUILD_TUPLE 1
  16. 25 LIST_APPEND 2
  17. 28 JUMP_ABSOLUTE 13
  18. >> 31 RETURN_VALUE
  19.  
  20. #Python 2.6
  21. 2 0 BUILD_LIST 0
  22. 3 DUP_TOP
  23. 4 STORE_FAST 0 (_[1])
  24. 7 LOAD_GLOBAL 0 (range)
  25. 10 LOAD_CONST 3 (1000000)
  26. 13 CALL_FUNCTION 1
  27. 16 GET_ITER
  28. >> 17 FOR_ITER 16 (to 36)
  29. 20 STORE_FAST 1 (i)
  30. 23 LOAD_FAST 0 (_[1])
  31. 26 LOAD_FAST 1 (i)
  32. 29 BUILD_TUPLE 1
  33. 32 LIST_APPEND
  34. 33 JUMP_ABSOLUTE 17
  35. >> 36 DELETE_FAST 0 (_[1])
  36. 39 RETURN_VALUE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement