Advertisement
Saltor

Untitled

Feb 19th, 2015
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. Python 2.7.5 (default, Mar  9 2014, 22:15:05)
  2. [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. >>> def literal():
  5. ...     return "the red cat".split(" ")
  6. ...
  7. >>> def explicit():
  8. ...     return str.split("the red cat", " ")
  9. ...
  10. >>> import dis
  11. >>> dis.dis(literal)
  12.   2           0 LOAD_CONST               1 ('the red cat')
  13.               3 LOAD_ATTR                0 (split)
  14.               6 LOAD_CONST               2 (' ')
  15.               9 CALL_FUNCTION            1
  16.              12 RETURN_VALUE        
  17. >>> dis.dis(explicit)
  18.   2           0 LOAD_GLOBAL              0 (str)
  19.               3 LOAD_ATTR                1 (split)
  20.               6 LOAD_CONST               1 ('the red cat')
  21.               9 LOAD_CONST               2 (' ')
  22.              12 CALL_FUNCTION            2
  23.              15 RETURN_VALUE        
  24. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement