Opcode | Mnemonics | Operand length | Description | Source Code | Assembly |
00h | STOP_CODE | 0 | Indicates end-of-code to the compiler, not used by the interpreter. |
# it's use in assembly code results in:
# SystemError: unknown opcode
|
|
01h | POP_TOP | 0 | Removes the top-of-stack (TOS) item. |
(lambda:1)()
|
<module>:
00000000 64 (00 00 = 00000031 CODE()) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 83 (00 00) - CALL_FUNCTION
00000009 01 - POP_TOP
0000000A 64 (01 00 = 00000096 None (4E)) - LOAD_CONST
0000000D 53 - RETURN_VALUE
<lambda>:
00000000 64 (00 00 = 00000050 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 53 - RETURN_VALUE
|
02h | ROT_TWO | 0 | Swaps the two top-most stack items. |
a = 1; b = 2
(a, b) = (b, a)
|
00000000 64 (00 00 = 00000040 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000050 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 64 (01 00 = 00000045 INT: 2 (02 00 00 00)) - LOAD_CONST
00000009 5A (01 00 = 00000056 STR: 'b' (01 00 00 00 62)) - STORE_NAME
0000000C 65 (01 00 = 00000056 STR: 'b' (01 00 00 00 62)) - LOAD_NAME
0000000F 65 (00 00 = 00000050 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 02 - ROT_TWO
00000013 5A (00 00 = 00000050 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000016 5A (01 00 = 00000056 STR: 'b' (01 00 00 00 62)) - STORE_NAME
00000019 64 (02 00 = 0000004A None (4E)) - LOAD_CONST
0000001C 53 - RETURN_VALUE
|
03h | ROT_THREE | 0 | Lifts second and third stack item one position up, moves top down to position three. |
a = 1
(a, a, a) = (a, a, a)
|
00000000 64 (00 00 = 00000041 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000004C STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 0000004C STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 65 (00 00 = 0000004C STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000000C 65 (00 00 = 0000004C STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000000F 03 - ROT_THREE
00000010 02 - ROT_TWO
00000011 5A (00 00 = 0000004C STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000014 5A (00 00 = 0000004C STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000017 5A (00 00 = 0000004C STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000001A 64 (01 00 = 00000046 None (4E)) - LOAD_CONST
0000001D 53 - RETURN_VALUE
|
04h | DUP_TOP | 0 | Duplicates the reference on top of the stack. |
{'a':1}
|
00000000 68 (00 00) - BUILD_MAP
00000003 04 - DUP_TOP
00000004 64 (00 00 = 00000034 INT: 1 (01 00 00 00)) - LOAD_CONST
00000007 02 - ROT_TWO
00000008 64 (01 00 = 00000039 STR: 'a' (01 00 00 00 61)) - LOAD_CONST
0000000B 3C - STORE_SUBSCR
0000000C 01 - POP_TOP
0000000D 64 (02 00 = 0000003F None (4E)) - LOAD_CONST
00000010 53 - RETURN_VALUE
|
05h | ROT_FOUR | 0 | Lifts second, third and forth stack item one position up, moves top down to position four. |
x = range(6)
x[2:4] += 'abc'
|
00000000 65 (00 00 = 00000063 STR: 'range' (05 00 00 00 72 61 6E 67 65)) - LOAD_NAME
00000003 64 (00 00 = 00000046 INT: 6 (06 00 00 00)) - LOAD_CONST
00000006 83 (01 00) - CALL_FUNCTION
00000009 5A (01 00 = 0000006D STR: 'x' (01 00 00 00 78)) - STORE_NAME
0000000C 65 (01 00 = 0000006D STR: 'x' (01 00 00 00 78)) - LOAD_NAME
0000000F 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000012 64 (02 00 = 00000050 INT: 4 (04 00 00 00)) - LOAD_CONST
00000015 63 (03 00) - DUP_TOPX
00000018 21 - SLICE+3
00000019 64 (03 00 = 00000055 STR: 'abc' (03 00 00 00 61...) - LOAD_CONST
0000001C 37 - INPLACE_ADD
0000001D 05 - ROT_FOUR
0000001E 2B - STORE_SLICE+3
0000001F 64 (04 00 = 0000005D None (4E)) - LOAD_CONST
00000022 53 - RETURN_VALUE
|
09h | NOP | 0 | Do nothing code. Used as a placeholder by the bytecode optimizer. |
# not generated by compiler or removed after optimizations
|
|
0Ah | UNARY_POSITIVE | 0 | Implements TOS = +TOS. |
a = 1
a = +a
|
00000000 64 (00 00 = 00000034 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 0A - UNARY_POSITIVE
0000000A 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 64 (01 00 = 00000039 None (4E)) - LOAD_CONST
00000010 53 - RETURN_VALUE
|
0Bh | UNARY_NEGATIVE | 0 | Implements TOS = -TOS. |
a = 1
a = -a
|
00000000 64 (00 00 = 00000034 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 0B - UNARY_NEGATIVE
0000000A 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 64 (01 00 = 00000039 None (4E)) - LOAD_CONST
00000010 53 - RETURN_VALUE
|
0Ch | UNARY_NOT | 0 | Implements TOS = not TOS. |
a = 1
a = not a
|
00000000 64 (00 00 = 00000034 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 0C - UNARY_NOT
0000000A 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 64 (01 00 = 00000039 None (4E)) - LOAD_CONST
00000010 53 - RETURN_VALUE
|
0Dh | UNARY_CONVERT | 0 | Implements TOS = `TOS`. |
a = 1
a = `a`
|
00000000 64 (00 00 = 00000034 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 0D - UNARY_CONVERT
0000000A 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 64 (01 00 = 00000039 None (4E)) - LOAD_CONST
00000010 53 - RETURN_VALUE
|
0Fh | UNARY_INVERT | 0 | Implements TOS = ~TOS. |
a = 1
a = ~a
|
00000000 64 (00 00 = 00000034 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 0F - UNARY_INVERT
0000000A 5A (00 00 = 0000003F STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 64 (01 00 = 00000039 None (4E)) - LOAD_CONST
00000010 53 - RETURN_VALUE
|
12h | LIST_APPEND | 0 | Calls list.append(TOS1, TOS). Used to implement list comprehensions. |
a = [i*i for i in (1,2)]
|
00000000 67 (00 00) - BUILD_LIST
00000003 04 - DUP_TOP
00000004 5A (00 00 = 0000006B STR: '_[1]' (04 00 00 00 5F 5B 31 5D)) - STORE_NAME
00000007 64 (03 00 = 00000057 TUPLE: (0000005C INT: ...) - LOAD_CONST
0000000A 44 - GET_ITER
0000000B 5D (11 00) - FOR_ITER
0000000E 5A (01 00 = 00000074 STR: 'i' (01 00 00 00 69)) - STORE_NAME
00000011 65 (00 00 = 0000006B STR: '_[1]' (04 00 00 00 5F 5B 31 5D)) - LOAD_NAME
00000014 65 (01 00 = 00000074 STR: 'i' (01 00 00 00 69)) - LOAD_NAME
00000017 65 (01 00 = 00000074 STR: 'i' (01 00 00 00 69)) - LOAD_NAME
0000001A 14 - BINARY_MULTIPLY
0000001B 12 - LIST_APPEND
0000001C 71 (0B 00) - JUMP_ABSOLUTE
0000001F 5B (00 00) - DELETE_NAME
00000022 5A (02 00 = 0000007A STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000025 64 (02 00 = 00000056 None (4E)) - LOAD_CONST
00000028 53 - RETURN_VALUE
|
13h | BINARY_POWER | 0 | Implements TOS = TOS1 ** TOS. |
a = 2
a = a ** 2
|
00000000 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
0000000C 13 - BINARY_POWER
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
14h | BINARY_MULTIPLY | 0 | Implements TOS = TOS1 * TOS. |
a = 2
a = a * 2
|
00000000 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
0000000C 14 - BINARY_MULTIPLY
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
15h | BINARY_DIVIDE | 0 | Implements TOS = TOS1 / TOS when from __future__ import division is not in effect. |
a = 2
a = a / 2
|
00000000 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
0000000C 15 - BINARY_DIVIDE
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
16h | BINARY_MODULO | 0 | Implements TOS = TOS1 % TOS. |
a = 2
a = a % 2
|
00000000 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
0000000C 16 - BINARY_MODULO
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
17h | BINARY_ADD | 0 | Implements TOS = TOS1 + TOS. |
a = 2
a = a + 2
|
00000000 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
0000000C 17 - BINARY_ADD
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
18h | BINARY_SUBTRACT | 0 | Implements TOS = TOS1 - TOS. |
a = 2
a = a - 2
|
00000000 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
0000000C 18 - BINARY_SUBTRACT
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
19h | BINARY_SUBSCR | 0 | Implements TOS = TOS1[TOS]. |
a = [1]
a[0]
|
00000000 64 (00 00 = 00000038 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 67 (01 00) - BUILD_LIST
00000006 5A (00 00 = 00000048 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000009 65 (00 00 = 00000048 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000000C 64 (01 00 = 0000003D INT: 0 (00 00 00 00)) - LOAD_CONST
0000000F 19 - BINARY_SUBSCR
00000010 01 - POP_TOP
00000011 64 (02 00 = 00000042 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
1Ah | BINARY_FLOOR_DIVIDE | 0 | Implements TOS = TOS1 // TOS. |
a = 2
a = a // 2
|
00000000 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 2 (02 00 00 00)) - LOAD_CONST
0000000C 1A - BINARY_FLOOR_DIVIDE
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
1Bh | BINARY_TRUE_DIVIDE | 0 | Implements TOS = TOS1 / TOS when from __future__ import division is in effect. |
from __future__ import division
a = 2
a = a / 2
|
00000000 64 (00 00 = 00000047 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 0000004C TUPLE: (00000051 STR: ...) - LOAD_CONST
00000006 6B (00 00 = 00000069 STR: '__future__' (0A 00 00 00 5F 5F 66 75 74 75 72 65...)) - IMPORT_NAME
00000009 6C (01 00 = 00000078 STR: 'division' (00 00 00 00)) - IMPORT_FROM
0000000C 5A (01 00 = 00000078 STR: 'division' (00 00 00 00)) - STORE_NAME
0000000F 01 - POP_TOP
00000010 64 (02 00 = 0000005E INT: 2 (02 00 00 00)) - LOAD_CONST
00000013 5A (02 00 = 0000007D STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000016 65 (02 00 = 0000007D STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000019 64 (02 00 = 0000005E INT: 2 (02 00 00 00)) - LOAD_CONST
0000001C 1B - BINARY_TRUE_DIVIDE
0000001D 5A (02 00 = 0000007D STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000020 64 (03 00 = 00000063 None (4E)) - LOAD_CONST
00000023 53 - RETURN_VALUE
|
1Ch | INPLACE_FLOOR_DIVIDE | 0 | Implements in-place TOS = TOS1 // TOS. |
a = 1
a //= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 1C - INPLACE_FLOOR_DIVIDE
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
1Dh | INPLACE_TRUE_DIVIDE | 0 | Implements in-place TOS = TOS1 / TOS when from __future__ import division is in effect. |
from __future__ import division
a = 1
a /= 2
|
00000000 64 (00 00 = 00000047 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 0000004C TUPLE: (00000051 STR: ...) - LOAD_CONST
00000006 6B (00 00 = 0000006E STR: '__future__' (0A 00 00 00 5F 5F 66 75 74 75 72 65...)) - IMPORT_NAME
00000009 6C (01 00 = 0000007D STR: 'division' (00 00 00 00)) - IMPORT_FROM
0000000C 5A (01 00 = 0000007D STR: 'division' (00 00 00 00)) - STORE_NAME
0000000F 01 - POP_TOP
00000010 64 (02 00 = 0000005E INT: 1 (01 00 00 00)) - LOAD_CONST
00000013 5A (02 00 = 00000082 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000016 65 (02 00 = 00000082 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000019 64 (03 00 = 00000063 INT: 2 (02 00 00 00)) - LOAD_CONST
0000001C 1D - INPLACE_TRUE_DIVIDE
0000001D 5A (02 00 = 00000082 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000020 64 (04 00 = 00000068 None (4E)) - LOAD_CONST
00000023 53 - RETURN_VALUE
|
1Eh | SLICE | 0 | Implements TOS = TOS[:]. |
a = [1,2,3]
a = a[:]
|
00000000 64 (00 00 = 0000003D INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000042 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000047 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 00000052 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 00000052 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 1E - SLICE
00000013 5A (00 00 = 00000052 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000016 64 (03 00 = 0000004C None (4E)) - LOAD_CONST
00000019 53 - RETURN_VALUE
|
1Fh | SLICE+1 | 0 | Implements TOS = TOS1[TOS:]. |
a = [1,2,3]
a = a[1:]
|
00000000 64 (00 00 = 00000040 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000045 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 0000004A INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 64 (00 00 = 00000040 INT: 1 (01 00 00 00)) - LOAD_CONST
00000015 1F - SLICE+1
00000016 5A (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000019 64 (03 00 = 0000004F None (4E)) - LOAD_CONST
0000001C 53 - RETURN_VALUE
|
20h | SLICE+2 | 0 | Implements TOS = TOS1[:TOS]. |
a = [1,2,3]
a = a[:2]
|
00000000 64 (00 00 = 00000040 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000045 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 0000004A INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 64 (01 00 = 00000045 INT: 2 (02 00 00 00)) - LOAD_CONST
00000015 20 - SLICE+2
00000016 5A (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000019 64 (03 00 = 0000004F None (4E)) - LOAD_CONST
0000001C 53 - RETURN_VALUE
|
21h | SLICE+3 | 0 | Implements TOS = TOS2[TOS1:TOS]. |
a = [1,2,3]
a = a[1:2]
|
00000000 64 (00 00 = 00000043 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000048 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 0000004D INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 00000058 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 00000058 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 64 (00 00 = 00000043 INT: 1 (01 00 00 00)) - LOAD_CONST
00000015 64 (01 00 = 00000048 INT: 2 (02 00 00 00)) - LOAD_CONST
00000018 21 - SLICE+3
00000019 5A (00 00 = 00000058 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000001C 64 (03 00 = 00000052 None (4E)) - LOAD_CONST
0000001F 53 - RETURN_VALUE
|
28h | STORE_SLICE | 0 | Implements TOS[:] = TOS1. |
a = [1,2,3]
a[:] = [1,2,3]
|
00000000 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000050 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
00000012 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000015 64 (02 00 = 00000050 INT: 3 (03 00 00 00)) - LOAD_CONST
00000018 67 (03 00) - BUILD_LIST
0000001B 65 (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000001E 28 - STORE_SLICE
0000001F 64 (03 00 = 00000055 None (4E)) - LOAD_CONST
00000022 53 - RETURN_VALUE
|
29h | STORE_SLICE+1 | 0 | Implements TOS1[TOS:] = TOS2. |
a = [1,2,3]
a[1:] = [2,3]
|
00000000 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000050 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000012 64 (02 00 = 00000050 INT: 3 (03 00 00 00)) - LOAD_CONST
00000015 67 (02 00) - BUILD_LIST
00000018 65 (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000001B 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
0000001E 29 - STORE_SLICE+1
0000001F 64 (03 00 = 00000055 None (4E)) - LOAD_CONST
00000022 53 - RETURN_VALUE
|
2Ah | STORE_SLICE+2 | 0 | Implements TOS1[:TOS] = TOS2. |
a = [1,2,3]
a[:2] = [1,2]
|
00000000 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000050 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
00000012 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000015 67 (02 00) - BUILD_LIST
00000018 65 (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000001B 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
0000001E 2A - STORE_SLICE+2
0000001F 64 (03 00 = 00000055 None (4E)) - LOAD_CONST
00000022 53 - RETURN_VALUE
|
2Bh | STORE_SLICE+3 | 0 | Implements TOS2[TOS1:TOS] = TOS3. |
a = [1,2,3]
a[1:2] = [2]
|
00000000 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000050 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
00000012 67 (01 00) - BUILD_LIST
00000015 65 (00 00 = 0000005B STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000018 64 (00 00 = 00000046 INT: 1 (01 00 00 00)) - LOAD_CONST
0000001B 64 (01 00 = 0000004B INT: 2 (02 00 00 00)) - LOAD_CONST
0000001E 2B - STORE_SLICE+3
0000001F 64 (03 00 = 00000055 None (4E)) - LOAD_CONST
00000022 53 - RETURN_VALUE
|
32h | DELETE_SLICE | 0 | Implements del TOS[:]. |
a = [1,2,3]
del a[:]
|
00000000 64 (00 00 = 0000003A INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000003F INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000044 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 0000004F STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 0000004F STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 32 - DELETE_SLICE
00000013 64 (03 00 = 00000049 None (4E)) - LOAD_CONST
00000016 53 - RETURN_VALUE
|
33h | DELETE_SLICE+1 | 0 | Implements del TOS1[TOS:]. |
a = [1,2,3]
del a[1:]
|
00000000 64 (00 00 = 0000003D INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000042 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000047 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 00000052 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 00000052 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 64 (00 00 = 0000003D INT: 1 (01 00 00 00)) - LOAD_CONST
00000015 33 - DELETE_SLICE+1
00000016 64 (03 00 = 0000004C None (4E)) - LOAD_CONST
00000019 53 - RETURN_VALUE
|
34h | DELETE_SLICE+2 | 0 | Implements del TOS1[:TOS]. |
a = [1,2,3]
del a[:2]
|
00000000 64 (00 00 = 0000003D INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000042 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000047 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 00000052 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 00000052 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 64 (01 00 = 00000042 INT: 2 (02 00 00 00)) - LOAD_CONST
00000015 34 - DELETE_SLICE+2
00000016 64 (03 00 = 0000004C None (4E)) - LOAD_CONST
00000019 53 - RETURN_VALUE
|
35h | DELETE_SLICE+3 | 0 | Implements del TOS2[TOS1:TOS]. |
a = [1,2,3]
del a[1:2]
|
00000000 64 (00 00 = 00000040 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000045 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 0000004A INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 5A (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000F 65 (00 00 = 00000055 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000012 64 (00 00 = 00000040 INT: 1 (01 00 00 00)) - LOAD_CONST
00000015 64 (01 00 = 00000045 INT: 2 (02 00 00 00)) - LOAD_CONST
00000018 35 - DELETE_SLICE+3
00000019 64 (03 00 = 0000004F None (4E)) - LOAD_CONST
0000001C 53 - RETURN_VALUE
|
37h | INPLACE_ADD | 0 | Implements in-place TOS = TOS1 + TOS. |
a = 1
a += 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 37 - INPLACE_ADD
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
38h | INPLACE_SUBTRACT | 0 | Implements in-place TOS = TOS1 - TOS. |
a = 1
a -= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 38 - INPLACE_SUBTRACT
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
39h | INPLACE_MULTIPLY | 0 | Implements in-place TOS = TOS1 * TOS. |
a = 1
a *= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 39 - INPLACE_MULTIPLY
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
3Ah | INPLACE_DIVIDE | 0 | Implements in-place TOS = TOS1 / TOS when from __future__ import division is not in effect. |
a = 1
a /= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 3A - INPLACE_DIVIDE
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
3Bh | INPLACE_MODULO | 0 | Implements in-place TOS = TOS1 % TOS. |
a = 1
a %= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 3B - INPLACE_MODULO
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
3Ch | STORE_SUBSCR | 0 | Implements TOS1[TOS] = TOS2. |
a = []
a[0] = 1
|
00000000 67 (00 00) - BUILD_LIST
00000003 5A (00 00 = 00000047 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000009 65 (00 00 = 00000047 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000000C 64 (01 00 = 0000003C INT: 0 (00 00 00 00)) - LOAD_CONST
0000000F 3C - STORE_SUBSCR
00000010 64 (02 00 = 00000041 None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
3Dh | DELETE_SUBSCR | 0 | Implements del TOS1[TOS]. |
a = [1]
del a[0]
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 67 (01 00) - BUILD_LIST
00000006 5A (00 00 = 00000047 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000009 65 (00 00 = 00000047 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000000C 64 (01 00 = 0000003C INT: 0 (00 00 00 00)) - LOAD_CONST
0000000F 3D - DELETE_SUBSCR
00000010 64 (02 00 = 00000041 None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
3Eh | BINARY_LSHIFT | 0 | Implements TOS = TOS1 << TOS. |
a = 1
a = a << 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 3E - BINARY_LSHIFT
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
3Fh | BINARY_RSHIFT | 0 | Implements TOS = TOS1 >> TOS. |
a = 1
a = a >> 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 3F - BINARY_RSHIFT
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
40h | BINARY_AND | 0 | Implements TOS = TOS1 & TOS. |
a = 1
a = a & 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 40 - BINARY_AND
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
41h | BINARY_XOR | 0 | Implements TOS = TOS1 ^ TOS. |
a = 1
a = a ^ 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 41 - BINARY_XOR
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
42h | BINARY_OR | 0 | Implements TOS = TOS1 | TOS. |
a = 1
a = a | 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 42 - BINARY_OR
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
43h | INPLACE_POWER | 0 | Implements in-place TOS = TOS1 ** TOS. |
a = 1
a **= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 43 - INPLACE_POWER
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
44h | GET_ITER | 0 | Implements TOS = iter(TOS). |
for a in (1,2): pass
|
00000000 78 (0E 00) - SETUP_LOOP
00000003 64 (03 00 = 00000043 TUPLE: (00000048 INT: ...) - LOAD_CONST
00000006 44 - GET_ITER
00000007 5D (06 00) - FOR_ITER
0000000A 5A (00 00 = 00000057 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 71 (07 00) - JUMP_ABSOLUTE
00000010 57 - POP_BLOCK
00000011 64 (02 00 = 00000042 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
46h | PRINT_EXPR | 0 | Implements the expression statement for the interactive mode. TOS is removed from the stack and printed. In non-interactive mode, an expression statement is terminated with POP_STACK. |
# used only in interactive mode
|
|
47h | PRINT_ITEM | 0 | Prints TOS to the file-like object bound to sys.stdout. There is one such instruction for each item in the print statement. |
print "hello world!"
|
00000000 64 (00 00 = 0000002C STR: 'hello world!' (0C 00...) - LOAD_CONST
00000003 47 - PRINT_ITEM
00000004 48 - PRINT_NEWLINE
00000005 64 (01 00 = 0000003D None (4E)) - LOAD_CONST
00000008 53 - RETURN_VALUE
|
48h | PRINT_NEWLINE | 0 | Prints a new line on sys.stdout. This is generated as the last operation of a print statement, unless the statement ends with a comma. |
print
|
00000000 48 - PRINT_NEWLINE
00000001 64 (00 00 = 00000028 None (4E)) - LOAD_CONST
00000004 53 - RETURN_VALUE
|
49h | PRINT_ITEM_TO | 0 | Like PRINT_ITEM, but prints the item second from TOS to the file-like object at TOS. This is used by the extended print statement. |
import sys
print >> sys.stdout, "hello world",
|
00000000 64 (00 00 = 00000040 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 00000045 None (4E)) - LOAD_CONST
00000006 6B (00 00 = 0000005B STR: 'sys' (03 00 00 00 73 79 73)) - IMPORT_NAME
00000009 5A (00 00 = 0000005B STR: 'sys' (03 00 00 00 73 79 73)) - STORE_NAME
0000000C 65 (00 00 = 0000005B STR: 'sys' (03 00 00 00 73 79 73)) - LOAD_NAME
0000000F 69 (01 00 = 00000063 STR: 'stdout' (06 00 00 00 73 74 64 6F 75 74)) - LOAD_ATTR
00000012 04 - DUP_TOP
00000013 64 (02 00 = 00000046 STR: 'hello world' (0B 00 ...) - LOAD_CONST
00000016 02 - ROT_TWO
00000017 49 - PRINT_ITEM_TO
00000018 01 - POP_TOP
00000019 64 (01 00 = 00000045 None (4E)) - LOAD_CONST
0000001C 53 - RETURN_VALUE
|
4Ah | PRINT_NEWLINE_TO | 0 | Like PRINT_NEWLINE, but prints the new line on the file-like object on the TOS. This is used by the extended print statement. |
import sys
print >> sys.stdout
|
00000000 64 (00 00 = 0000003A INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 0000003F None (4E)) - LOAD_CONST
00000006 6B (00 00 = 00000045 STR: 'sys' (03 00 00 00 73 79 73)) - IMPORT_NAME
00000009 5A (00 00 = 00000045 STR: 'sys' (03 00 00 00 73 79 73)) - STORE_NAME
0000000C 65 (00 00 = 00000045 STR: 'sys' (03 00 00 00 73 79 73)) - LOAD_NAME
0000000F 69 (01 00 = 0000004D STR: 'stdout' (06 00 00 00 73 74 64 6F 75 74)) - LOAD_ATTR
00000012 4A - PRINT_NEWLINE_TO
00000013 64 (01 00 = 0000003F None (4E)) - LOAD_CONST
00000016 53 - RETURN_VALUE
|
4Bh | INPLACE_LSHIFT | 0 | Implements in-place TOS = TOS1 << TOS. |
a = 1
a <<= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 4B - INPLACE_LSHIFT
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
4Ch | INPLACE_RSHIFT | 0 | Implements in-place TOS = TOS1 >> TOS. |
a = 1
a >>= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 4C - INPLACE_RSHIFT
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
4Dh | INPLACE_AND | 0 | Implements in-place TOS = TOS1 & TOS. |
a = 1
a &= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 4D - INPLACE_AND
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
4Eh | INPLACE_XOR | 0 | Implements in-place TOS = TOS1 ^ TOS. |
a = 1
a ^= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 4E - INPLACE_XOR
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
4Fh | INPLACE_OR | 0 | Implements in-place TOS = TOS1 | TOS. |
a = 1
a |= 1
|
00000000 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 64 (00 00 = 00000037 INT: 1 (01 00 00 00)) - LOAD_CONST
0000000C 4F - INPLACE_OR
0000000D 5A (00 00 = 00000042 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000010 64 (01 00 = 0000003C None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
50h | BREAK_LOOP | 0 | Terminates a loop due to a break statement. |
for a in (1,2): break
|
00000000 78 (0F 00) - SETUP_LOOP
00000003 64 (03 00 = 00000044 TUPLE: (00000049 INT: ...) - LOAD_CONST
00000006 44 - GET_ITER
00000007 5D (07 00) - FOR_ITER
0000000A 5A (00 00 = 00000058 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 50 - BREAK_LOOP
0000000E 71 (07 00) - JUMP_ABSOLUTE
00000011 57 - POP_BLOCK
00000012 64 (02 00 = 00000043 None (4E)) - LOAD_CONST
00000015 53 - RETURN_VALUE
|
51h | WITH_CLEANUP | 0 | ??? |
from __future__ import with_statement
with open("1.txt") as f:
print f.read()
|
00000000 64 (00 00 = 00000073 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 00000078 TUPLE: (0000007D STR: ...) - LOAD_CONST
00000006 6B (00 00 = 000000A0 STR: '__future__' (0A 00 00 00 5F 5F 66 75 74 75 72 65...)) - IMPORT_NAME
00000009 6C (01 00 = 000000AF STR: 'with_statement' (00 00 00 00)) - IMPORT_FROM
0000000C 5A (01 00 = 000000AF STR: 'with_statement' (00 00 00 00)) - STORE_NAME
0000000F 01 - POP_TOP
00000010 65 (02 00 = 000000B4 STR: 'open' (04 00 00 00 6F 70 65 6E)) - LOAD_NAME
00000013 64 (02 00 = 00000090 STR: '1.txt' (05 00 00 00 ...) - LOAD_CONST
00000016 83 (01 00) - CALL_FUNCTION
00000019 04 - DUP_TOP
0000001A 69 (03 00 = 000000BD STR: '__exit__' (08 00 00 00 5F 5F 65 78 69 74 5F 5F)) - LOAD_ATTR
0000001D 5A (04 00 = 000000CA STR: '_[1]' (04 00 00 00 5F 5B 31 5D)) - STORE_NAME
00000020 69 (05 00 = 000000D3 STR: '__enter__' (09 00 00 00 5F 5F 65 6E 74 65 72 5F...)) - LOAD_ATTR
00000023 83 (00 00) - CALL_FUNCTION
00000026 5A (06 00 = 000000E1 STR: '_[2]' (04 00 00 00 5F 5B 32 5D)) - STORE_NAME
00000029 7A (18 00 = 00000044) - SETUP_FINALLY
0000002C 65 (06 00 = 000000E1 STR: '_[2]' (04 00 00 00 5F 5B 32 5D)) - LOAD_NAME
0000002F 5B (06 00 = 000000E1 STR: '_[2]' (04 00 00 00 5F 5B 32 5D)) - DELETE_NAME
00000032 5A (07 00 = 000000EA STR: 'f' (01 00 00 00 66)) - STORE_NAME
00000035 65 (07 00 = 000000EA STR: 'f' (01 00 00 00 66)) - LOAD_NAME
00000038 69 (08 00 = 000000F0 STR: 'read' (04 00 00 00 72 65 61 64)) - LOAD_ATTR
0000003B 83 (00 00) - CALL_FUNCTION
0000003E 47 - PRINT_ITEM
0000003F 48 - PRINT_NEWLINE
00000040 57 - POP_BLOCK
00000041 64 (03 00 = 0000009A None (4E)) - LOAD_CONST
00000044 65 (04 00 = 000000CA STR: '_[1]' (04 00 00 00 5F 5B 31 5D)) - LOAD_NAME
00000047 5B (04 00 = 000000CA STR: '_[1]' (04 00 00 00 5F 5B 31 5D)) - DELETE_NAME
0000004A 51 - WITH_CLEANUP
0000004B 58 - END_FINALLY
0000004C 64 (03 00 = 0000009A None (4E)) - LOAD_CONST
0000004F 53 - RETURN_VALUE
|
52h | LOAD_LOCALS | 0 | Pushes a reference to the locals of the current scope on the stack. This is used in the code for a class definition: After the class body is evaluated, the locals are passed to the class definition. |
class a: pass
|
a:
00000000 65 (00 00 = 00000068 STR: '__name__' (08 00 00 00 5F 5F 6E 61 6D 65 5F 5F)) - LOAD_NAME
00000003 5A (01 00 = 00000075 STR: '__module__' (0A 00 00 00 5F 5F 6D 6F 64 75 6C 65...)) - STORE_NAME
00000006 52 - LOAD_LOCALS
00000007 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 0000003A STR: 'a' (01 00 00 00 61)) - LOAD_CONST
00000003 64 (03 00 = 000000BF TUPLE: ()) - LOAD_CONST
00000006 64 (01 00 = 00000040 CODE(a)) - LOAD_CONST
00000009 84 (00 00) - MAKE_FUNCTION
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 59 - BUILD_CLASS
00000010 5A (00 00 = 000000C9 STR: 'a' (00 00 00 00)) - STORE_NAME
00000013 64 (02 00 = 000000BE None (4E)) - LOAD_CONST
00000016 53 - RETURN_VALUE
|
53h | RETURN_VALUE | 0 | Returns with TOS to the caller of the function. |
# empty file
|
00000000 64 (00 00 = 00000027 None (4E)) - LOAD_CONST
00000003 53 - RETURN_VALUE
|
54h | IMPORT_STAR | 0 | Loads all symbols not starting with "_" directly from the module TOS to the local namespace. The module is popped after loading all names. This opcode implements from module import *. |
from sys import *
|
00000000 64 (00 00 = 00000031 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 00000036 TUPLE: (0000003B STR: ...) - LOAD_CONST
00000006 6B (00 00 = 00000047 STR: 'sys' (03 00 00 00 73 79 73)) - IMPORT_NAME
00000009 54 - IMPORT_STAR
0000000A 64 (02 00 = 00000041 None (4E)) - LOAD_CONST
0000000D 53 - RETURN_VALUE
|
55h | EXEC_STMT | 0 | Implements exec TOS2,TOS1,TOS. The compiler fills missing optional parameters with None. |
exec("print 'hello world'", globals(), locals())
|
00000000 64 (00 00 = 0000003E STR: "print 'hello world'"...) - LOAD_CONST
00000003 65 (00 00 = 0000005C STR: 'globals' (07 00 00 00 67 6C 6F 62 61 6C 73)) - LOAD_NAME
00000006 83 (00 00) - CALL_FUNCTION
00000009 65 (01 00 = 00000068 STR: 'locals' (06 00 00 00 6C 6F 63 61 6C 73)) - LOAD_NAME
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 66 (03 00) - BUILD_TUPLE
00000012 64 (01 00 = 00000056 None (4E)) - LOAD_CONST
00000015 04 - DUP_TOP
00000016 55 - EXEC_STMT
00000017 64 (01 00 = 00000056 None (4E)) - LOAD_CONST
0000001A 53 - RETURN_VALUE
|
56h | YIELD_VALUE | 0 | Pops TOS and yields it from a generator. |
def foo():
print 'hello'
yield 1
print 'world'
yield 2
a = foo()
print a.next()
print a.next()
|
foo:
00000000 64 (01 00 = 00000083 STR: 'hello' (05 00 00 00 ...) - LOAD_CONST
00000003 47 - PRINT_ITEM
00000004 48 - PRINT_NEWLINE
00000005 64 (02 00 = 0000008D INT: 1 (01 00 00 00)) - LOAD_CONST
00000008 56 - YIELD_VALUE
00000009 01 - POP_TOP
0000000A 64 (03 00 = 00000092 STR: 'world' (05 00 00 00 ...) - LOAD_CONST
0000000D 47 - PRINT_ITEM
0000000E 48 - PRINT_NEWLINE
0000000F 64 (04 00 = 0000009C INT: 2 (02 00 00 00)) - LOAD_CONST
00000012 56 - YIELD_VALUE
00000013 01 - POP_TOP
00000014 64 (00 00 = 00000082 None (4E)) - LOAD_CONST
00000017 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 0000004F CODE(foo)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 000000EF STR: 'foo' (02 00 00 00)) - STORE_NAME
00000009 65 (00 00 = 000000EF STR: 'foo' (02 00 00 00)) - LOAD_NAME
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 5A (01 00 = 000000F4 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000012 65 (01 00 = 000000F4 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000015 69 (02 00 = 000000FA STR: 'next' (04 00 00 00 6E 65 78 74)) - LOAD_ATTR
00000018 83 (00 00) - CALL_FUNCTION
0000001B 47 - PRINT_ITEM
0000001C 48 - PRINT_NEWLINE
0000001D 65 (01 00 = 000000F4 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000020 69 (02 00 = 000000FA STR: 'next' (04 00 00 00 6E 65 78 74)) - LOAD_ATTR
00000023 83 (00 00) - CALL_FUNCTION
00000026 47 - PRINT_ITEM
00000027 48 - PRINT_NEWLINE
00000028 64 (01 00 = 000000E9 None (4E)) - LOAD_CONST
0000002B 53 - RETURN_VALUE
|
57h | POP_BLOCK | 0 | Removes one block from the block stack. Per frame, there is a stack of blocks, denoting nested loops, try statements, and such. |
for a in (1,2): break
|
00000000 78 (0F 00) - SETUP_LOOP
00000003 64 (03 00 = 00000044 TUPLE: (00000049 INT: ...) - LOAD_CONST
00000006 44 - GET_ITER
00000007 5D (07 00) - FOR_ITER
0000000A 5A (00 00 = 00000058 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000D 50 - BREAK_LOOP
0000000E 71 (07 00) - JUMP_ABSOLUTE
00000011 57 - POP_BLOCK
00000012 64 (02 00 = 00000043 None (4E)) - LOAD_CONST
00000015 53 - RETURN_VALUE
|
58h | END_FINALLY | 0 | Terminates a finally clause. The interpreter recalls whether the exception has to be re-raised, or whether the function returns, and continues with the outer-next block. |
try:
a = 1
except ValueError:
a = 2
finally:
a = 3
|
00000000 7A (2A 00) - SETUP_FINALLY
00000003 79 (0A 00) - SETUP_EXCEPT
00000006 64 (00 00 = 0000005B INT: 1 (01 00 00 00)) - LOAD_CONST
00000009 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000C 57 - POP_BLOCK
0000000D 6E (19 00) - JUMP_FORWARD
00000010 04 - DUP_TOP
00000011 65 (01 00 = 00000076 STR: 'ValueError' (0A 00 00 00 56 61 6C 75 65 45 72 72...)) - LOAD_NAME
00000014 6A (0A 00 = "EXC_MATCH") - COMPARE_OP
00000017 6F (0D 00) - JUMP_IF_FALSE
0000001A 01 - POP_TOP
0000001B 01 - POP_TOP
0000001C 01 - POP_TOP
0000001D 01 - POP_TOP
0000001E 64 (01 00 = 00000060 INT: 2 (02 00 00 00)) - LOAD_CONST
00000021 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000024 6E (02 00) - JUMP_FORWARD
00000027 01 - POP_TOP
00000028 58 - END_FINALLY
00000029 57 - POP_BLOCK
0000002A 64 (02 00 = 00000065 None (4E)) - LOAD_CONST
0000002D 64 (03 00 = 00000066 INT: 3 (03 00 00 00)) - LOAD_CONST
00000030 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000033 58 - END_FINALLY
00000034 64 (02 00 = 00000065 None (4E)) - LOAD_CONST
00000037 53 - RETURN_VALUE
|
59h | BUILD_CLASS | 0 | Creates a new class object. TOS is the methods dictionary, TOS1 the tuple of the names of the base classes, and TOS2 the class name. |
class a: pass
|
a:
00000000 65 (00 00 = 00000068 STR: '__name__' (08 00 00 00 5F 5F 6E 61 6D 65 5F 5F)) - LOAD_NAME
00000003 5A (01 00 = 00000075 STR: '__module__' (0A 00 00 00 5F 5F 6D 6F 64 75 6C 65...)) - STORE_NAME
00000006 52 - LOAD_LOCALS
00000007 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 0000003A STR: 'a' (01 00 00 00 61)) - LOAD_CONST
00000003 64 (03 00 = 000000BF TUPLE: ()) - LOAD_CONST
00000006 64 (01 00 = 00000040 CODE(a)) - LOAD_CONST
00000009 84 (00 00) - MAKE_FUNCTION
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 59 - BUILD_CLASS
00000010 5A (00 00 = 000000C9 STR: 'a' (00 00 00 00)) - STORE_NAME
00000013 64 (02 00 = 000000BE None (4E)) - LOAD_CONST
00000016 53 - RETURN_VALUE
|
5Ah | STORE_NAME | 2 | Implements name = TOS. /namei/ is the index of name in the attribute co_names of the code object. The compiler tries to use STORE_LOCAL or STORE_GLOBAL if possible. |
a = 1
|
00000000 64 (00 00 = 0000002D INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000038 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 64 (01 00 = 00000032 None (4E)) - LOAD_CONST
00000009 53 - RETURN_VALUE
|
5Bh | DELETE_NAME | 2 | Implements del name, where /namei/ is the index into co_names attribute of the code object. |
a = 1
del a
|
00000000 64 (00 00 = 00000030 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000003B STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 5B (00 00 = 0000003B STR: 'a' (01 00 00 00 61)) - DELETE_NAME
00000009 64 (01 00 = 00000035 None (4E)) - LOAD_CONST
0000000C 53 - RETURN_VALUE
|
5Ch | UNPACK_SEQUENCE | 2 | Unpacks TOS into /count/ individual values, which are put onto the stack right-to-left. |
(a, b) = "ab"
|
00000000 64 (00 00 = 00000033 STR: 'ab' (02 00 00 00 61 ...) - LOAD_CONST
00000003 5C (02 00) - UNPACK_SEQUENCE
00000006 5A (00 00 = 00000040 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000009 5A (01 00 = 00000046 STR: 'b' (01 00 00 00 62)) - STORE_NAME
0000000C 64 (01 00 = 0000003A None (4E)) - LOAD_CONST
0000000F 53 - RETURN_VALUE
|
5Dh | FOR_ITER | 2 | TOS is an iterator. Call its next() method. If this yields a new value, push it on the stack (leaving the iterator below it). If the iterator indicates it is exhausted TOS is popped, and the byte code counter is incremented by /delta/. |
for i in (1,2): pass
|
00000000 78 (0E 00) - SETUP_LOOP
00000003 64 (03 00 = 00000043 TUPLE: (00000048 INT: ...) - LOAD_CONST
00000006 44 - GET_ITER
00000007 5D (06 00) - FOR_ITER
0000000A 5A (00 00 = 00000057 STR: 'i' (01 00 00 00 69)) - STORE_NAME
0000000D 71 (07 00) - JUMP_ABSOLUTE
00000010 57 - POP_BLOCK
00000011 64 (02 00 = 00000042 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
5Fh | STORE_ATTR | 2 | Implements TOS.name = TOS1, where /namei/ is the index of name in co_names. |
import sys
sys.stderr = sys.stdout
|
00000000 64 (00 00 = 0000003F INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 00000044 None (4E)) - LOAD_CONST
00000006 6B (00 00 = 0000004A STR: 'sys' (03 00 00 00 73 79 73)) - IMPORT_NAME
00000009 5A (00 00 = 0000004A STR: 'sys' (03 00 00 00 73 79 73)) - STORE_NAME
0000000C 65 (00 00 = 0000004A STR: 'sys' (03 00 00 00 73 79 73)) - LOAD_NAME
0000000F 69 (01 00 = 00000052 STR: 'stdout' (06 00 00 00 73 74 64 6F 75 74)) - LOAD_ATTR
00000012 65 (00 00 = 0000004A STR: 'sys' (03 00 00 00 73 79 73)) - LOAD_NAME
00000015 5F (02 00 = 0000005D STR: 'stderr' (06 00 00 00 73 74 64 65 72 72)) - STORE_ATTR
00000018 64 (01 00 = 00000044 None (4E)) - LOAD_CONST
0000001B 53 - RETURN_VALUE
|
60h | DELETE_ATTR | 2 | Implements del TOS.name, using /namei/ as index into co_names. |
import sys
del sys.stderr
|
00000000 64 (00 00 = 00000039 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 0000003E None (4E)) - LOAD_CONST
00000006 6B (00 00 = 00000044 STR: 'sys' (03 00 00 00 73 79 73)) - IMPORT_NAME
00000009 5A (00 00 = 00000044 STR: 'sys' (03 00 00 00 73 79 73)) - STORE_NAME
0000000C 65 (00 00 = 00000044 STR: 'sys' (03 00 00 00 73 79 73)) - LOAD_NAME
0000000F 60 (01 00 = 0000004C STR: 'stderr' (06 00 00 00 73 74 64 65 72 72)) - DELETE_ATTR
00000012 64 (01 00 = 0000003E None (4E)) - LOAD_CONST
00000015 53 - RETURN_VALUE
|
61h | STORE_GLOBAL | 2 | Works as STORE_NAME(/namei/), but stores the name as a global. |
global a
a = 1
|
00000000 64 (00 00 = 0000002D INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 61 (00 00 = 00000038 STR: 'a' (01 00 00 00 61)) - STORE_GLOBAL
00000006 64 (01 00 = 00000032 None (4E)) - LOAD_CONST
00000009 53 - RETURN_VALUE
|
62h | DELETE_GLOBAL | 2 | Works as DELETE_NAME(/namei/), but deletes a global name. |
global a
del a
|
00000000 62 (00 00 = 00000030 STR: 'a' (01 00 00 00 61)) - DELETE_GLOBAL
00000003 64 (00 00 = 0000002A None (4E)) - LOAD_CONST
00000006 53 - RETURN_VALUE
|
63h | DUP_TOPX | None | Duplicate /count/ items, keeping them in the same order. Due to implementation limits, count should be between 1 and 5 inclusive. |
a = 0
b = [0]
b[a] += 1
|
00000000 64 (00 00 = 00000046 INT: 0 (00 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000056 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 64 (00 00 = 00000046 INT: 0 (00 00 00 00)) - LOAD_CONST
00000009 67 (01 00) - BUILD_LIST
0000000C 5A (01 00 = 0000005C STR: 'b' (01 00 00 00 62)) - STORE_NAME
0000000F 65 (01 00 = 0000005C STR: 'b' (01 00 00 00 62)) - LOAD_NAME
00000012 65 (00 00 = 00000056 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000015 63 (02 00) - DUP_TOPX
00000018 19 - BINARY_SUBSCR
00000019 64 (01 00 = 0000004B INT: 1 (01 00 00 00)) - LOAD_CONST
0000001C 37 - INPLACE_ADD
0000001D 03 - ROT_THREE
0000001E 3C - STORE_SUBSCR
0000001F 64 (02 00 = 00000050 None (4E)) - LOAD_CONST
00000022 53 - RETURN_VALUE
|
64h | LOAD_CONST | 2 | Pushes "co_consts[/consti/]" onto the stack. |
a = 1
|
00000000 64 (00 00 = 0000002D INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000038 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 64 (01 00 = 00000032 None (4E)) - LOAD_CONST
00000009 53 - RETURN_VALUE
|
65h | LOAD_NAME | 2 | Pushes the value associated with "co_names[/namei/]" onto the stack. |
a = 1
a = a
|
00000000 64 (00 00 = 00000033 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 0000003E STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 0000003E STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 5A (00 00 = 0000003E STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000C 64 (01 00 = 00000038 None (4E)) - LOAD_CONST
0000000F 53 - RETURN_VALUE
|
66h | BUILD_TUPLE | 2 | Creates a tuple consuming /count/ items from the stack, and pushes the resulting tuple onto the stack. |
a = 1;
a = (a, a)
|
00000000 64 (00 00 = 00000039 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 5A (00 00 = 00000044 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000006 65 (00 00 = 00000044 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000009 65 (00 00 = 00000044 STR: 'a' (01 00 00 00 61)) - LOAD_NAME
0000000C 66 (02 00) - BUILD_TUPLE
0000000F 5A (00 00 = 00000044 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000012 64 (01 00 = 0000003E None (4E)) - LOAD_CONST
00000015 53 - RETURN_VALUE
|
67h | BUILD_LIST | 2 | Works as BUILD_TUPLE(/count/), but creates a list. |
[1,2,3]
|
00000000 64 (00 00 = 00000034 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000039 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 0000003E INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 67 (03 00) - BUILD_LIST
0000000C 01 - POP_TOP
0000000D 64 (03 00 = 00000043 None (4E)) - LOAD_CONST
00000010 53 - RETURN_VALUE
|
68h | BUILD_MAP | 2 | Pushes a new empty dictionary object onto the stack. The argument is ignored and set to /zero/ by the compiler. |
{"a":1,"b":2}
|
00000000 68 (00 00) - BUILD_MAP
00000003 04 - DUP_TOP
00000004 64 (00 00 = 0000003D INT: 1 (01 00 00 00)) - LOAD_CONST
00000007 02 - ROT_TWO
00000008 64 (01 00 = 00000042 STR: 'a' (01 00 00 00 61)) - LOAD_CONST
0000000B 3C - STORE_SUBSCR
0000000C 04 - DUP_TOP
0000000D 64 (02 00 = 00000048 INT: 2 (02 00 00 00)) - LOAD_CONST
00000010 02 - ROT_TWO
00000011 64 (03 00 = 0000004D STR: 'b' (01 00 00 00 62)) - LOAD_CONST
00000014 3C - STORE_SUBSCR
00000015 01 - POP_TOP
00000016 64 (04 00 = 00000053 None (4E)) - LOAD_CONST
00000019 53 - RETURN_VALUE
|
69h | LOAD_ATTR | 2 | Replaces TOS with getattr(TOS, co_names[/namei/]). |
[].sort()
|
00000000 67 (00 00) - BUILD_LIST
00000003 69 (00 00 = 00000037 STR: 'sort' (04 00 00 00 73 6F 72 74)) - LOAD_ATTR
00000006 83 (00 00) - CALL_FUNCTION
00000009 01 - POP_TOP
0000000A 64 (00 00 = 00000031 None (4E)) - LOAD_CONST
0000000D 53 - RETURN_VALUE
|
6Ah | COMPARE_OP | 2 | Performs a Boolean operation. The operation name can be found in cmp_op[/opname/]. |
a = 1 == 2
|
00000000 64 (00 00 = 00000033 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000038 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 6A (02 00 = "==") - COMPARE_OP
00000009 5A (00 00 = 00000043 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000C 64 (02 00 = 0000003D None (4E)) - LOAD_CONST
0000000F 53 - RETURN_VALUE
|
6Bh | IMPORT_NAME | 2 | Imports the module co_names[/namei/]. The module object is pushed onto the stack. The current namespace is not affected: for a proper import statement, a subsequent STORE_FAST instruction modifies the namespace. |
import new
|
00000000 64 (00 00 = 00000033 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 00000038 None (4E)) - LOAD_CONST
00000006 6B (00 00 = 0000003E STR: 'new' (03 00 00 00 6E 65 77)) - IMPORT_NAME
00000009 5A (00 00 = 0000003E STR: 'new' (03 00 00 00 6E 65 77)) - STORE_NAME
0000000C 64 (01 00 = 00000038 None (4E)) - LOAD_CONST
|
6Ch | IMPORT_FROM | 2 | Loads the attribute co_names[/namei/] from the module found in TOS. The resulting object is pushed onto the stack, to be subsequently stored by a STORE_FAST instruction. |
from dis import opmap
|
00000000 64 (00 00 = 00000037 INT: -1 (FF FF FF FF)) - LOAD_CONST
00000003 64 (01 00 = 0000003C TUPLE: (00000041 STR: ...) - LOAD_CONST
00000006 6B (00 00 = 00000051 STR: 'dis' (03 00 00 00 64 69 73)) - IMPORT_NAME
00000009 6C (01 00 = 00000059 STR: 'opmap' (00 00 00 00)) - IMPORT_FROM
0000000C 5A (01 00 = 00000059 STR: 'opmap' (00 00 00 00)) - STORE_NAME
0000000F 01 - POP_TOP
00000010 64 (02 00 = 0000004B None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
6Eh | JUMP_FORWARD | 2 | Increments byte code counter by /delta/. |
if 1 == 2: pass
else: pass
|
00000000 64 (00 00 = 00000038 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000003D INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 6A (02 00 = "==") - COMPARE_OP
00000009 6F (04 00) - JUMP_IF_FALSE
0000000C 01 - POP_TOP
0000000D 6E (01 00) - JUMP_FORWARD
00000010 01 - POP_TOP
00000011 64 (02 00 = 00000042 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
6Fh | JUMP_IF_FALSE | 2 | If TOS is false, increment the byte code counter by /delta/. TOS is not changed. |
if 1 == 2: pass
else: pass
|
00000000 64 (00 00 = 00000038 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000003D INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 6A (02 00 = "==") - COMPARE_OP
00000009 6F (04 00) - JUMP_IF_FALSE
0000000C 01 - POP_TOP
0000000D 6E (01 00) - JUMP_FORWARD
00000010 01 - POP_TOP
00000011 64 (02 00 = 00000042 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
70h | JUMP_IF_TRUE | 2 | If TOS is true, increment the byte code counter by /delta/. TOS is left on the stack. |
if not(1 == 2): pass
else: pass
|
00000000 64 (00 00 = 00000038 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 0000003D INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 6A (02 00 = "==") - COMPARE_OP
00000009 70 (04 00) - JUMP_IF_TRUE
0000000C 01 - POP_TOP
0000000D 6E (01 00) - JUMP_FORWARD
00000010 01 - POP_TOP
00000011 64 (02 00 = 00000042 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
71h | JUMP_ABSOLUTE | 2 | Set byte code counter to /target/. |
for i in (1,2): pass
|
00000000 78 (0E 00) - SETUP_LOOP
00000003 64 (03 00 = 00000043 TUPLE: (00000048 INT: ...) - LOAD_CONST
00000006 44 - GET_ITER
00000007 5D (06 00) - FOR_ITER
0000000A 5A (00 00 = 00000057 STR: 'i' (01 00 00 00 69)) - STORE_NAME
0000000D 71 (07 00) - JUMP_ABSOLUTE
00000010 57 - POP_BLOCK
00000011 64 (02 00 = 00000042 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
74h | LOAD_GLOBAL | 2 | Loads the global named co_names[/namei/] onto the stack. |
global a
a = 1
a = a
|
00000000 64 (00 00 = 00000033 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 61 (00 00 = 0000003E STR: 'a' (01 00 00 00 61)) - STORE_GLOBAL
00000006 74 (00 00 = 0000003E STR: 'a' (01 00 00 00 61)) - LOAD_GLOBAL
00000009 61 (00 00 = 0000003E STR: 'a' (01 00 00 00 61)) - STORE_GLOBAL
0000000C 64 (01 00 = 00000038 None (4E)) - LOAD_CONST
0000000F 53 - RETURN_VALUE
|
77h | CONTINUE_LOOP | 2 | Continues a loop due to a continue statement. /target/ is the address to jump to (which should be a FOR_ITER instruction). |
for x in (1,2):
try: continue
except: pass
|
00000000 78 (1F 00 = 00000022) - SETUP_LOOP
00000003 64 (03 00 = 00000054 TUPLE: (00000059 INT: ...) - LOAD_CONST
00000006 44 - GET_ITER
00000007 5D (17 00 = 00000021) - FOR_ITER
0000000A 5A (00 00 = 00000068 STR: 'x' (01 00 00 00 78)) - STORE_NAME
0000000D 79 (07 00 = 00000017) - SETUP_EXCEPT
00000010 77 (07 00) - CONTINUE_LOOP
00000013 57 - POP_BLOCK
00000014 71 (07 00 = 00000007) - JUMP_ABSOLUTE
00000017 01 - POP_TOP
00000018 01 - POP_TOP
00000019 01 - POP_TOP
0000001A 71 (07 00 = 00000007) - JUMP_ABSOLUTE
0000001D 58 - END_FINALLY
0000001E 71 (07 00 = 00000007) - JUMP_ABSOLUTE
00000021 57 - POP_BLOCK
00000022 64 (02 00 = 00000053 None (4E)) - LOAD_CONST
00000025 53 - RETURN_VALUE
|
78h | SETUP_LOOP | 2 | Pushes a block for a loop onto the block stack. The block spans from the current instruction with a size of /delta/ bytes. |
while 0 > 1: pass
|
00000000 78 (12 00) - SETUP_LOOP
00000003 64 (00 00 = 0000003C INT: 0 (00 00 00 00)) - LOAD_CONST
00000006 64 (01 00 = 00000041 INT: 1 (01 00 00 00)) - LOAD_CONST
00000009 6A (04 00 = ">") - COMPARE_OP
0000000C 6F (04 00) - JUMP_IF_FALSE
0000000F 01 - POP_TOP
00000010 71 (03 00) - JUMP_ABSOLUTE
00000013 01 - POP_TOP
00000014 57 - POP_BLOCK
00000015 64 (02 00 = 00000046 None (4E)) - LOAD_CONST
00000018 53 - RETURN_VALUE
|
79h | SETUP_EXCEPT | 2 | Pushes a try block from a try-except clause onto the block stack. /delta/ points to the first except block. |
try:
a = 1
except ValueError:
a = 2
finally:
a = 3
|
00000000 7A (2A 00) - SETUP_FINALLY
00000003 79 (0A 00) - SETUP_EXCEPT
00000006 64 (00 00 = 0000005B INT: 1 (01 00 00 00)) - LOAD_CONST
00000009 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000C 57 - POP_BLOCK
0000000D 6E (19 00) - JUMP_FORWARD
00000010 04 - DUP_TOP
00000011 65 (01 00 = 00000076 STR: 'ValueError' (0A 00 00 00 56 61 6C 75 65 45 72 72...)) - LOAD_NAME
00000014 6A (0A 00 = "EXC_MATCH") - COMPARE_OP
00000017 6F (0D 00) - JUMP_IF_FALSE
0000001A 01 - POP_TOP
0000001B 01 - POP_TOP
0000001C 01 - POP_TOP
0000001D 01 - POP_TOP
0000001E 64 (01 00 = 00000060 INT: 2 (02 00 00 00)) - LOAD_CONST
00000021 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000024 6E (02 00) - JUMP_FORWARD
00000027 01 - POP_TOP
00000028 58 - END_FINALLY
00000029 57 - POP_BLOCK
0000002A 64 (02 00 = 00000065 None (4E)) - LOAD_CONST
0000002D 64 (03 00 = 00000066 INT: 3 (03 00 00 00)) - LOAD_CONST
00000030 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000033 58 - END_FINALLY
00000034 64 (02 00 = 00000065 None (4E)) - LOAD_CONST
00000037 53 - RETURN_VALUE
|
7Ah | SETUP_FINALLY | 2 | Pushes a try block from a try-except clause onto the block stack. /delta/ points to the finally block. |
try:
a = 1
except ValueError:
a = 2
finally:
a = 3
|
00000000 7A (2A 00) - SETUP_FINALLY
00000003 79 (0A 00) - SETUP_EXCEPT
00000006 64 (00 00 = 0000005B INT: 1 (01 00 00 00)) - LOAD_CONST
00000009 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
0000000C 57 - POP_BLOCK
0000000D 6E (19 00) - JUMP_FORWARD
00000010 04 - DUP_TOP
00000011 65 (01 00 = 00000076 STR: 'ValueError' (0A 00 00 00 56 61 6C 75 65 45 72 72...)) - LOAD_NAME
00000014 6A (0A 00 = "EXC_MATCH") - COMPARE_OP
00000017 6F (0D 00) - JUMP_IF_FALSE
0000001A 01 - POP_TOP
0000001B 01 - POP_TOP
0000001C 01 - POP_TOP
0000001D 01 - POP_TOP
0000001E 64 (01 00 = 00000060 INT: 2 (02 00 00 00)) - LOAD_CONST
00000021 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000024 6E (02 00) - JUMP_FORWARD
00000027 01 - POP_TOP
00000028 58 - END_FINALLY
00000029 57 - POP_BLOCK
0000002A 64 (02 00 = 00000065 None (4E)) - LOAD_CONST
0000002D 64 (03 00 = 00000066 INT: 3 (03 00 00 00)) - LOAD_CONST
00000030 5A (00 00 = 00000070 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000033 58 - END_FINALLY
00000034 64 (02 00 = 00000065 None (4E)) - LOAD_CONST
00000037 53 - RETURN_VALUE
|
7Ch | LOAD_FAST | 2 | Pushes a reference to the local co_varnames[/var_num/] onto the stack. |
def f():
a = 1
a = a
|
f:
00000000 64 (01 00 = 0000005C INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 7D (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - STORE_FAST
00000006 7C (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - LOAD_FAST
00000009 7D (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - STORE_FAST
0000000C 64 (00 00 = 0000005B None (4E)) - LOAD_CONST
0000000F 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000030 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 000000AD STR: 'f' (01 00 00 00)) - STORE_NAME
00000009 64 (01 00 = 000000A7 None (4E)) - LOAD_CONST
0000000C 53 - RETURN_VALUE
|
7Dh | STORE_FAST | 2 | Stores TOS into the local co_varnames[/var_num/]. |
def f():
a = 1
a = a
|
f:
00000000 64 (01 00 = 0000005C INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 7D (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - STORE_FAST
00000006 7C (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - LOAD_FAST
00000009 7D (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - STORE_FAST
0000000C 64 (00 00 = 0000005B None (4E)) - LOAD_CONST
0000000F 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000030 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 000000AD STR: 'f' (01 00 00 00)) - STORE_NAME
00000009 64 (01 00 = 000000A7 None (4E)) - LOAD_CONST
0000000C 53 - RETURN_VALUE
|
7Eh | DELETE_FAST | 2 | Deletes local co_varnames[/var_num/]. |
def f():
a = 1
del a
|
f:
00000000 64 (01 00 = 00000059 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 7D (00 00 = 00000068 STR: 'a' (01 00 00 00 61)) - STORE_FAST
00000006 7E (00 00 = 00000068 STR: 'a' (01 00 00 00 61)) - DELETE_FAST
00000009 64 (00 00 = 00000058 None (4E)) - LOAD_CONST
0000000C 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000030 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 000000AC STR: 'f' (01 00 00 00)) - STORE_NAME
00000009 64 (01 00 = 000000A6 None (4E)) - LOAD_CONST
0000000C 53 - RETURN_VALUE
|
82h | RAISE_VARARGS | 2 | Raises an exception. /argc/ indicates the number of parameters to the raise statement, ranging from 0 to 3. The handler will find the traceback as TOS2, the parameter as TOS1, and the exception as TOS. |
raise ValueError
|
00000000 65 (00 00 = 00000033 STR: 'ValueError' (0A 00 00 00 56 61 6C 75 65 45 72 72...)) - LOAD_NAME
00000003 82 (01 00) - RAISE_VARARGS
00000006 64 (00 00 = 0000002D None (4E)) - LOAD_CONST
00000009 53 - RETURN_VALUE
|
83h | CALL_FUNCTION | 2 | Calls a function. The low byte of /argc/ indicates the number of positional parameters, the high byte the number of keyword parameters. On the stack, the opcode finds the keyword parameters first. For each keyword argument, the value is on top of the key. Below the keyword parameters, the positional parameters are on the stack, with the right-most parameter on top. Below the parameters, the function object to call is on the stack. |
def f(): pass
f()
|
f:
00000000 64 (00 00 = 00000056 None (4E)) - LOAD_CONST
00000003 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000037 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 0000009D STR: 'f' (00 00 00 00)) - STORE_NAME
00000009 65 (00 00 = 0000009D STR: 'f' (00 00 00 00)) - LOAD_NAME
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 01 - POP_TOP
00000010 64 (01 00 = 00000097 None (4E)) - LOAD_CONST
00000013 53 - RETURN_VALUE
|
84h | MAKE_FUNCTION | 2 | Pushes a new function object on the stack. TOS is the code associated with the function. The function object is defined to have /argc/ default parameters, which are found below TOS. |
def f(): pass
|
f:
00000000 64 (00 00 = 0000004F None (4E)) - LOAD_CONST
00000003 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000030 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 00000096 STR: 'f' (00 00 00 00)) - STORE_NAME
00000009 64 (01 00 = 00000090 None (4E)) - LOAD_CONST
0000000C 53 - RETURN_VALUE
|
85h | BUILD_SLICE | 2 | Pushes a slice object on the stack. /argc/ must be 2 or 3. If it is 2, slice(TOS1, TOS) is pushed; if it is 3, slice(TOS2, TOS1, TOS) is pushed. See the slice() built-in function for more information. |
a = [1,2,3,4]
b = a[::-1]
|
00000000 64 (00 00 = 0000004C INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00000051 INT: 2 (02 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 00000056 INT: 3 (03 00 00 00)) - LOAD_CONST
00000009 64 (03 00 = 0000005B INT: 4 (04 00 00 00)) - LOAD_CONST
0000000C 67 (04 00) - BUILD_LIST
0000000F 5A (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - STORE_NAME
00000012 65 (00 00 = 0000006B STR: 'a' (01 00 00 00 61)) - LOAD_NAME
00000015 64 (04 00 = 00000060 None (4E)) - LOAD_CONST
00000018 64 (04 00 = 00000060 None (4E)) - LOAD_CONST
0000001B 64 (05 00 = 00000061 INT: -1 (FF FF FF FF)) - LOAD_CONST
0000001E 85 (03 00) - BUILD_SLICE
00000021 19 - BINARY_SUBSCR
00000022 5A (01 00 = 00000071 STR: 'b' (01 00 00 00 62)) - STORE_NAME
00000025 64 (04 00 = 00000060 None (4E)) - LOAD_CONST
00000028 53 - RETURN_VALUE
|
86h | MAKE_CLOSURE | 2 | Creates a new function object, sets its func_closure slot, and pushes it on the stack. TOS is the code associated with the function. If the code object has N free variables, the next N items on the stack are the cells for these variables. The function also has /argc/ default parameters, where are found before the cells. |
def f():
a = 1
def g():
return a + 1
return g()
print f()
|
g:
00000000 88 (00 00 = 000000AD STR: 'a' (01 00 00 00 61)) - LOAD_DEREF
00000003 64 (01 00 = 00000099 INT: 1 (01 00 00 00)) - LOAD_CONST
00000006 17 - BINARY_ADD
00000007 53 - RETURN_VALUE
f:
00000000 64 (01 00 = 00000070 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 89 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - STORE_DEREF
00000006 87 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - LOAD_CLOSURE
00000009 66 (01 00) - BUILD_TUPLE
0000000C 64 (02 00 = 00000075 CODE(g)) - LOAD_CONST
0000000F 86 (00 00) - MAKE_CLOSURE
00000012 7D (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - STORE_FAST
00000015 7C (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - LOAD_FAST
00000018 83 (00 00) - CALL_FUNCTION
0000001B 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000038 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 0000013C STR: 'f' (02 00 00 00)) - STORE_NAME
00000009 65 (00 00 = 0000013C STR: 'f' (02 00 00 00)) - LOAD_NAME
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 47 - PRINT_ITEM
00000010 48 - PRINT_NEWLINE
00000011 64 (01 00 = 00000136 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
87h | LOAD_CLOSURE | 2 | Pushes a reference to the cell contained in slot /i/ of the cell and free variable storage. The name of the variable is co_cellvars[i] if i is less than the length of co_cellvars. Otherwise it is co_freevars[i - len(co_cellvars)]. |
def f():
a = 1
def g():
return a + 1
return g()
print f()
|
g:
00000000 88 (00 00 = 000000AD STR: 'a' (01 00 00 00 61)) - LOAD_DEREF
00000003 64 (01 00 = 00000099 INT: 1 (01 00 00 00)) - LOAD_CONST
00000006 17 - BINARY_ADD
00000007 53 - RETURN_VALUE
f:
00000000 64 (01 00 = 00000070 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 89 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - STORE_DEREF
00000006 87 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - LOAD_CLOSURE
00000009 66 (01 00) - BUILD_TUPLE
0000000C 64 (02 00 = 00000075 CODE(g)) - LOAD_CONST
0000000F 86 (00 00) - MAKE_CLOSURE
00000012 7D (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - STORE_FAST
00000015 7C (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - LOAD_FAST
00000018 83 (00 00) - CALL_FUNCTION
0000001B 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000038 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 0000013C STR: 'f' (02 00 00 00)) - STORE_NAME
00000009 65 (00 00 = 0000013C STR: 'f' (02 00 00 00)) - LOAD_NAME
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 47 - PRINT_ITEM
00000010 48 - PRINT_NEWLINE
00000011 64 (01 00 = 00000136 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
88h | LOAD_DEREF | 2 | Loads the cell contained in slot /i/ of the cell and free variable storage. Pushes a reference to the object the cell contains on the stack. |
def f():
a = 1
def g():
return a + 1
return g()
print f()
|
g:
00000000 88 (00 00 = 000000AD STR: 'a' (01 00 00 00 61)) - LOAD_DEREF
00000003 64 (01 00 = 00000099 INT: 1 (01 00 00 00)) - LOAD_CONST
00000006 17 - BINARY_ADD
00000007 53 - RETURN_VALUE
f:
00000000 64 (01 00 = 00000070 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 89 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - STORE_DEREF
00000006 87 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - LOAD_CLOSURE
00000009 66 (01 00) - BUILD_TUPLE
0000000C 64 (02 00 = 00000075 CODE(g)) - LOAD_CONST
0000000F 86 (00 00) - MAKE_CLOSURE
00000012 7D (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - STORE_FAST
00000015 7C (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - LOAD_FAST
00000018 83 (00 00) - CALL_FUNCTION
0000001B 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000038 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 0000013C STR: 'f' (02 00 00 00)) - STORE_NAME
00000009 65 (00 00 = 0000013C STR: 'f' (02 00 00 00)) - LOAD_NAME
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 47 - PRINT_ITEM
00000010 48 - PRINT_NEWLINE
00000011 64 (01 00 = 00000136 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
89h | STORE_DEREF | 2 | Stores TOS into the cell contained in slot /i/ of the cell and free variable storage. |
def f():
a = 1
def g():
return a + 1
return g()
print f()
|
g:
00000000 88 (00 00 = 000000AD STR: 'a' (01 00 00 00 61)) - LOAD_DEREF
00000003 64 (01 00 = 00000099 INT: 1 (01 00 00 00)) - LOAD_CONST
00000006 17 - BINARY_ADD
00000007 53 - RETURN_VALUE
f:
00000000 64 (01 00 = 00000070 INT: 1 (01 00 00 00)) - LOAD_CONST
00000003 89 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - STORE_DEREF
00000006 87 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - LOAD_CLOSURE
00000009 66 (01 00) - BUILD_TUPLE
0000000C 64 (02 00 = 00000075 CODE(g)) - LOAD_CONST
0000000F 86 (00 00) - MAKE_CLOSURE
00000012 7D (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - STORE_FAST
00000015 7C (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - LOAD_FAST
00000018 83 (00 00) - CALL_FUNCTION
0000001B 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000038 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 0000013C STR: 'f' (02 00 00 00)) - STORE_NAME
00000009 65 (00 00 = 0000013C STR: 'f' (02 00 00 00)) - LOAD_NAME
0000000C 83 (00 00) - CALL_FUNCTION
0000000F 47 - PRINT_ITEM
00000010 48 - PRINT_NEWLINE
00000011 64 (01 00 = 00000136 None (4E)) - LOAD_CONST
00000014 53 - RETURN_VALUE
|
8Ch | CALL_FUNCTION_VAR | 2 | Calls a function. /argc/ is interpreted as in CALL_FUNCTION. The top element on the stack contains the variable argument list, followed by keyword and positional arguments. |
def f(a,b): pass
a = (1,2)
f(*a)
|
f:
00000000 64 (00 00 = 0000005F None (4E)) - LOAD_CONST
00000003 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000040 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 000000CF STR: 'f' (02 00 00 00)) - STORE_NAME
00000009 64 (04 00 = 000000BB TUPLE: (000000C0 INT: ...) - LOAD_CONST
0000000C 5A (01 00 = 000000D4 STR: 'a' (00 00 00 00)) - STORE_NAME
0000000F 65 (00 00 = 000000CF STR: 'f' (02 00 00 00)) - LOAD_NAME
00000012 65 (01 00 = 000000D4 STR: 'a' (00 00 00 00)) - LOAD_NAME
00000015 8C (00 00) - CALL_FUNCTION_VAR
00000018 01 - POP_TOP
00000019 64 (03 00 = 000000BA None (4E)) - LOAD_CONST
0000001C 53 - RETURN_VALUE
|
8Dh | CALL_FUNCTION_KW | 2 | Calls a function. /argc/ is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by explicit keyword and positional arguments. |
def f(a,b): pass
a = {"a":1,"b":2}
f(**a)
|
f:
00000000 64 (00 00 = 00000071 None (4E)) - LOAD_CONST
00000003 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 00000052 CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 000000DB STR: 'f' (02 00 00 00)) - STORE_NAME
00000009 68 (00 00) - BUILD_MAP
0000000C 04 - DUP_TOP
0000000D 64 (01 00 = 000000C1 INT: 1 (01 00 00 00)) - LOAD_CONST
00000010 02 - ROT_TWO
00000011 64 (02 00 = 000000C6 STR: 'a' (00 00 00 00)) - LOAD_CONST
00000014 3C - STORE_SUBSCR
00000015 04 - DUP_TOP
00000016 64 (03 00 = 000000CB INT: 2 (02 00 00 00)) - LOAD_CONST
00000019 02 - ROT_TWO
0000001A 64 (04 00 = 000000D0 STR: 'b' (01 00 00 00)) - LOAD_CONST
0000001D 3C - STORE_SUBSCR
0000001E 5A (01 00 = 000000E0 STR: 'a' (00 00 00 00)) - STORE_NAME
00000021 65 (00 00 = 000000DB STR: 'f' (02 00 00 00)) - LOAD_NAME
00000024 65 (01 00 = 000000E0 STR: 'a' (00 00 00 00)) - LOAD_NAME
00000027 8D (00 00) - CALL_FUNCTION_KW
0000002A 01 - POP_TOP
0000002B 64 (05 00 = 000000D5 None (4E)) - LOAD_CONST
0000002E 53 - RETURN_VALUE
|
8Eh | CALL_FUNCTION_VAR_KW | 2 | Calls a function. /argc/ is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by the variable-arguments tuple, followed by explicit keyword and positional arguments. |
def f(a,b,c): pass
a = {"b":1,"c":2}
b = (3,)
f(*b, **a)
|
f:
00000000 64 (00 00 = 0000007A None (4E)) - LOAD_CONST
00000003 53 - RETURN_VALUE
<module>:
00000000 64 (00 00 = 0000005B CODE(f)) - LOAD_CONST
00000003 84 (00 00) - MAKE_FUNCTION
00000006 5A (00 00 = 000000FD STR: 'f' (03 00 00 00)) - STORE_NAME
00000009 68 (00 00) - BUILD_MAP
0000000C 04 - DUP_TOP
0000000D 64 (01 00 = 000000D4 INT: 1 (01 00 00 00)) - LOAD_CONST
00000010 02 - ROT_TWO
00000011 64 (02 00 = 000000D9 STR: 'b' (01 00 00 00)) - LOAD_CONST
00000014 3C - STORE_SUBSCR
00000015 04 - DUP_TOP
00000016 64 (03 00 = 000000DE INT: 2 (02 00 00 00)) - LOAD_CONST
00000019 02 - ROT_TWO
0000001A 64 (04 00 = 000000E3 STR: 'c' (02 00 00 00)) - LOAD_CONST
0000001D 3C - STORE_SUBSCR
0000001E 5A (01 00 = 00000102 STR: 'a' (00 00 00 00)) - STORE_NAME
00000021 64 (07 00 = 000000EE TUPLE: (000000F3 INT: ...) - LOAD_CONST
00000024 5A (02 00 = 00000107 STR: 'b' (01 00 00 00)) - STORE_NAME
00000027 65 (00 00 = 000000FD STR: 'f' (03 00 00 00)) - LOAD_NAME
0000002A 65 (02 00 = 00000107 STR: 'b' (01 00 00 00)) - LOAD_NAME
0000002D 65 (01 00 = 00000102 STR: 'a' (00 00 00 00)) - LOAD_NAME
00000030 8E (00 00) - CALL_FUNCTION_VAR_KW
00000033 01 - POP_TOP
00000034 64 (06 00 = 000000ED None (4E)) - LOAD_CONST
00000037 53 - RETURN_VALUE
|
8Fh | EXTENDED_ARG | 2 | Support for opargs more than 16 bits long. |
a=(0,1,2,3, ... ,65535)
|
00000000 64 (00 00 = 00030033 INT: 0 (00 00 00 00)) - LOAD_CONST
00000003 64 (01 00 = 00030038 INT: 1 (01 00 00 00)) - LOAD_CONST
00000006 64 (02 00 = 0003003D INT: 2 (02 00 00 00)) - LOAD_CONST
...
0002FFF7 64 (FD FF = 00080024 INT: 65533 (FD FF 00 00)) - LOAD_CONST
0002FFFA 64 (FE FF = 00080029 INT: 65534 (FE FF 00 00)) - LOAD_CONST
0002FFFD 64 (FF FF = 0008002E INT: 65535 (FF FF 00 00)) - LOAD_CONST
00030000 8F (01 00) - EXTENDED_ARG
00030003 66 (00 00) - BUILD_TUPLE
00030006 5A (00 00 = 00080039 STR: 'a' (01 00 00 00 61)) - STORE_NAME
00030009 8F (01 00) - EXTENDED_ARG
0003000C 64 (00 00 = 00030033 INT: 0 (00 00 00 00)) - LOAD_CONST
0003000F 53 - RETURN_VALUE
|