Created
February 12, 2015 17:57
-
-
Save jsocol/5ca69c9dd5761f55bfd4 to your computer and use it in GitHub Desktop.
python is less crazy than it seems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In [8]: def t(): | |
| f = ([],) | |
| f[0] += [1] | |
| return f | |
| ...: | |
| In [9]: dis.dis(t) | |
| 2 0 BUILD_LIST 0 | |
| 3 BUILD_TUPLE 1 | |
| 6 STORE_FAST 0 (f) | |
| 3 9 LOAD_FAST 0 (f) | |
| 12 LOAD_CONST 1 (0) | |
| 15 DUP_TOPX 2 | |
| 18 BINARY_SUBSCR | |
| 19 LOAD_CONST 2 (1) | |
| 22 BUILD_LIST 1 | |
| 25 INPLACE_ADD | |
| 26 ROT_THREE | |
| 27 STORE_SUBSCR | |
| 4 28 LOAD_FAST 0 (f) | |
| 31 RETURN_VALUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment