Re[4]: backslashes and r-strings r"abc"

Lenard Lindstrom <[email protected]> Tue, 27 Jul 2004 09:10:36 -0700 (Pacific Daylight Time)
Newsgroups gmane.comp.lang.prothon.user
Message-ID <Mahogany-0.66.0-4294580231-20040727-095600.00@pop3.norton.antivirus>
On Mon, 26 Jul 2004 22:39:01 -0700 Michael Geary <[email protected]> wrote:

> > From: Lenard Lindstrom
> > Backslash for line continuation in a raw string is 
> > broken for both Prothon and Python anyways:
> > 
> > Python 2.4a1 (#54, Jul  8 2004, 11:30:13) [MSC v.1310 32 bit 
> > (Intel)] on win32 Type "help", "copyright", "credits" or 
> > "license" for more information.
> > >>> r"abc\
> > ... def"
> > 'abc\\\ndef'
> 
> By "broken" do you mean "not working according to the spec" or "I don't like
> what it does"?
>
Broken in that it is inconsistent with non-raw strings where the backslash at the
end of the line is a line continuation. It also does nothing useful that I can see.

> This is working as specified: The backslash escapes the next character so it
> does nothing special, and both the backslash and the next character remain
> in the string. The resulting string here consists of "abc", backslash,
> newline, and "def", as it is supposed to.
> 
Okay, I had to get to the last line of the second to last paragraph in section 2.4.1
of the _Python_Reference_Manual_ to find it. "Note also that a single backslash followed
by a newline is interpreted as those two characters as part of the string, _not_ as a line
continuation."

Lenard Lindstrom