day03$ cat declare.py
i = 1
l = []
d = {}
s = 'str'
day03$ cat declare.txt
day03$ vi declare.py
day03$ ipython
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
Type "copyright", "credits" or "license" for more information.
In [1]: s = open('de')
%%debug %debug declare.py def del delattr
In [1]: s = open('declare.py').read()
In [2]: co = compile(s, 'declare.py', 'exec')
In [3]: import dis
In [4]: dis.dis(co)
2 0 LOAD_CONST 0 (1)
3 STORE_NAME 0 (i)
4 6 BUILD_LIST 0
9 STORE_NAME 1 (l)
6 12 BUILD_MAP 0
15 STORE_NAME 2 (d)
8 18 LOAD_CONST 1 ('str')
21 STORE_NAME 3 (s)
24 LOAD_CONST 2 (None)
27 RETURN_VALUE
In [5]:
day03$
来源:oschina
链接:https://my.oschina.net/u/2300652/blog/704228