Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. (synapse_353) foo@vbar:$ python
  2. Python 3.5.3 (default, Apr 10 2017, 19:09:11)
  3. [GCC 5.4.0 20160609] on linux
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. Running from /home/foo/.pythonrc
  6. Loading [os]
  7. Loading [sys]
  8. Loading [json]
  9. Loading [base64]
  10. Loading [logging]
  11. Loading [collections]
  12. Loading [pprint as pprint]
  13. Reload not found in builtin, defining reload()
  14. Bound "tab" as autocomplete key.
  15. Done loading from [/home/foo/.pythonrc]
  16. >>> def f1(a, b):
  17. ... if a != b:
  18. ... raise Exception
  19. ... return str(a)
  20. ...
  21. >>> def f2(a, b):
  22. ... assert a == b
  23. ... return str(a)
  24. ...
  25. >>> import dis
  26. >>> dis.dis(f1)
  27. 2 0 LOAD_FAST 0 (a)
  28. 3 LOAD_FAST 1 (b)
  29. 6 COMPARE_OP 3 (!=)
  30. 9 POP_JUMP_IF_FALSE 18
  31.  
  32. 3 12 LOAD_GLOBAL 0 (Exception)
  33. 15 RAISE_VARARGS 1
  34.  
  35. 4 >> 18 LOAD_GLOBAL 1 (str)
  36. 21 LOAD_FAST 0 (a)
  37. 24 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
  38. 27 RETURN_VALUE
  39. >>> dis.dis(f2)
  40. 2 0 LOAD_FAST 0 (a)
  41. 3 LOAD_FAST 1 (b)
  42. 6 COMPARE_OP 2 (==)
  43. 9 POP_JUMP_IF_TRUE 18
  44. 12 LOAD_GLOBAL 0 (AssertionError)
  45. 15 RAISE_VARARGS 1
  46.  
  47. 3 >> 18 LOAD_GLOBAL 1 (str)
  48. 21 LOAD_FAST 0 (a)
  49. 24 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
  50. 27 RETURN_VALUE
  51. >>> exit()
  52. (synapse_353) foo@vbar:$ python -O
  53. Python 3.5.3 (default, Apr 10 2017, 19:09:11)
  54. [GCC 5.4.0 20160609] on linux
  55. Type "help", "copyright", "credits" or "license" for more information.
  56. Running from /home/foo/.pythonrc
  57. Loading [os]
  58. Loading [sys]
  59. Loading [json]
  60. Loading [base64]
  61. Loading [logging]
  62. Loading [collections]
  63. Loading [pprint as pprint]
  64. Reload not found in builtin, defining reload()
  65. Bound "tab" as autocomplete key.
  66. Done loading from [/home/foo/.pythonrc]
  67. >>> def f2_o(a, b):
  68. ... assert a == b
  69. ... return str(a)
  70. ...
  71. >>> import dis
  72. >>> dis.dis(f2_o)
  73. 3 0 LOAD_GLOBAL 0 (str)
  74. 3 LOAD_FAST 0 (a)
  75. 6 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
  76. 9 RETURN_VALUE
  77. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement