Eric V. Smith <[email protected]> added the comment:
The existing behavior is what I'd expect.
Using python3:
>>> import ast
>>> s = open('file.py', 'rb').read()
>>> s
b'"""\nHello \\n blah.\n"""\n'
>>> ast.dump(ast.parse(s))
"Module(body=[Expr(value=Str(s='\\nHello \\n blah.\\n'))])"
>>> eval(s)
'\nHello \n blah.\n'
As always with the AST, some information is lost. It's not designed to be able
to round-trip back to the source text.
----------
nosy: +eric.smith
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36911>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com