Date: 05 Sep 2022
Module: dis Installation: pip install dis About: The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode.h and used by the compiler and the interpreter. Source Code: import dis def print_hello(string): print("Hello", string) # This will display the disassembly of print_hello dis.dis(print_hello) Output: 4 0 LOAD_GLOBAL 0 (print) 2 LOAD_CONST 1 ('Hello') 4 LOAD_FAST 0 (string) 6 CALL_FUNCTION 2 8 POP_TOP 10 LOAD_CONST 0 (None) 12 RETURN_VALUE Reference: https://pypi.org/project/dis/
_______________________________________________ Chennaipy mailing list Chennaipy@python.org https://mail.python.org/mailman/listinfo/chennaipy