[Python-Dev] eval and triple quoted strings

Ron Adam ron3200 at gmail.com
Fri Jun 14 20:11:11 CEST 2013



On 06/14/2013 10:36 AM, Guido van Rossum wrote:
> Not a bug. The same is done for file input -- CRLF is changed to LF before
> tokenizing.


Should this be the same?


python3 -c 'print(bytes("""\r\n""", "utf8"))'
b'\r\n'


 >>> eval('print(bytes("""\r\n""", "utf8"))')
b'\n'



Ron



> On Jun 14, 2013 8:27 AM, "Walter Dörwald" <walter at livinglogic.de
> <mailto:walter at livinglogic.de>> wrote:
>
>     Hello all!
>
>     This surprised me:
>
>         >>> eval("'''\r\n'''")
>         '\n'
>
>     Where did the \r go? ast.literal_eval() has the same problem:
>
>         >>> ast.literal_eval("'''\r\n'''")
>         '\n'
>
>     Is this a bug/worth fixing?
>
>     Servus,
>         Walter
>     _________________________________________________
>     Python-Dev mailing list
>     Python-Dev at python.org <mailto:Python-Dev at python.org>
>     http://mail.python.org/__mailman/listinfo/python-dev
>     <http://mail.python.org/mailman/listinfo/python-dev>
>     Unsubscribe:
>     http://mail.python.org/__mailman/options/python-dev/__guido%40python.org <http://mail.python.org/mailman/options/python-dev/guido%40python.org>
>


More information about the Python-Dev mailing list