[Python-Dev] eval and triple quoted strings
PJ Eby
pje at telecommunity.com
Fri Jun 14 23:03:14 CEST 2013
More information about the Python-Dev mailing list
Fri Jun 14 23:03:14 CEST 2013
- Previous message: [Python-Dev] eval and triple quoted strings
- Next message: [Python-Dev] eval and triple quoted strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jun 14, 2013 at 2:11 PM, Ron Adam <ron3200 at gmail.com> wrote: > > > 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' No, but: eval(r'print(bytes("""\r\n""", "utf8"))') should be. (And is.) What I believe you and Walter are missing is that the \r\n in the eval strings are converted early if you don't make the enclosing string raw. So what you're eval-ing is not what you think you are eval-ing, hence the confusion.
- Previous message: [Python-Dev] eval and triple quoted strings
- Next message: [Python-Dev] eval and triple quoted strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list