With gcc you can use -S to stop compilation after your code has been compiled into assembly. Is there a similar feature with Python/bytecode? I know of ways like:
import dis x = compile('print(1)', '', 'eval') dis.dis(x) Which prints:
1 0 LOAD_NAME 0 (print) 2 LOAD_CONST 0 (1) 4 CALL_FUNCTION 1 6 RETURN_VALUE But I'm thinking of something more along the lines of:
> python3 -{SOME FLAG HERE} output my_script.py Which outputs a file containing the scripts bytecode in a readable format.