[issue6507] Enhance dis.dis to autocompile codestrings

Nick Coghlan report at bugs.python.org
Sat Jul 18 15:48:55 CEST 2009

Nick Coghlan <ncoghlan at gmail.com> added the comment:

As per Georg's suggestion, a better approach would look like:

from dis import dis
def dis_str(source):
    c = compile(source, '', 'eval')
  except SyntaxError:
    c = compile(source, '', 'exec')
  return dis(c)


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list