jupyterlab-python-bytecode icon indicating copy to clipboard operation
jupyterlab-python-bytecode copied to clipboard

Add option to show details from `code_info`

Open jtpio opened this issue 5 years ago • 0 comments

It would be interesting to have an option in the "Advanced Settings Editor" to show the details that come from dis.code_info, and display it on the top of the panel (before the bytecode) or in a different JupyterLab widget.

For example:

import dis

code_to_eval = """
a = 2
b = a + 1
"""

code = compile(code_to_eval, '<string>', 'exec')
code_info = dis.code_info(code)
print(code_info)

would output:

Name:              <module>
Filename:          <string>
Argument count:    0
Kw-only arguments: 0
Number of locals:  0
Stack size:        2
Flags:             NOFREE
Constants:
   0: 2
   1: 1
   2: None
Names:
   0: a
   1: b

jtpio avatar Sep 30 '18 09:09 jtpio