Torsten Landschoff <t.landsch...@gmx.net> added the comment: I offer the attached patch as a starting point to fulfill this feature request.
The patch changes the output to insert the disassembly of local code objects on the referencing line. As that made the output unreadable to me, I added indentation for the nested code (by 4 spaces, hoping that nobody will nest code 10 levels deep :-) This results in the following output for the original example: >>> from dis import dis >>> dis('[x**2 for x in range(3)]') 1 0 LOAD_CONST 0 (<code object <listcomp> at 0x7f24a67dde40, file "<dis>", line 1>) 1 0 BUILD_LIST 0 3 LOAD_FAST 0 (.0) >> 6 FOR_ITER 16 (to 25) 9 STORE_FAST 1 (x) 12 LOAD_FAST 1 (x) 15 LOAD_CONST 0 (2) 18 BINARY_POWER 19 LIST_APPEND 2 22 JUMP_ABSOLUTE 6 >> 25 RETURN_VALUE 3 LOAD_CONST 1 ('<listcomp>') 6 MAKE_FUNCTION 0 9 LOAD_NAME 0 (range) 12 LOAD_CONST 2 (3) 15 CALL_FUNCTION 1 18 GET_ITER 19 CALL_FUNCTION 1 22 RETURN_VALUE ---------- keywords: +patch nosy: +torsten Added file: http://bugs.python.org/file23908/issue11822.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11822> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com