jeudi 21 juillet 2016

Meaning of '>>' in Python byte code

I have disassembled the following python code

def factorial(n):
    if n <= 1:
        return 1
    elif n == 2:
        return 2
    elif n ==4:
        print('hi')
    return n * 2

and the resulting bytecode

2        0 LOAD_FAST                0 (n)
         3 LOAD_CONST               1 (1)
         6 COMPARE_OP               1 (<=)
         9 POP_JUMP_IF_FALSE       16

3        12 LOAD_CONST               1 (1)
         15 RETURN_VALUE        

4     >> 16 LOAD_FAST                0 (n)
         19 LOAD_CONST               2 (2)
         22 COMPARE_OP               2 (==)
         25 POP_JUMP_IF_FALSE       32

5        28 LOAD_CONST               2 (2)
         31 RETURN_VALUE        

6     >> 32 LOAD_FAST                0 (n)
         35 LOAD_CONST               2 (2)
         38 BINARY_MULTIPLY     
         39 RETURN_VALUE        

What do the '>>' symbols in the above bytecode stand for?

Aucun commentaire:

Enregistrer un commentaire