RE: backslashes and r-strings r"abc"
"Mark Hahn" <[email protected]> Mon, 26 Jul 2004 21:25:36 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <000101c47391$c3fbd590$0d01a8c0@MarkVaio> |
Greg Ewing wrote: > Mark Hahn <[email protected]>: > > > Does anyone see any reason to preserve Python's restriction on not > > having a backslash as the last character of a r-string? > > The reason it's there is because, even inside r-strings, > backslashes still escape quote characters. Oops. My Python in a nutshell didn't make this clear. Prothon doesn't have \" for escaped quotes. > To remove it, > you'd have to either disallow quotes embedded in r-strings, > or come up with some other way of flagging them without > compromising the rawness quality of r-strings. > > > r"c:\windows directory\" # throws Python exception > > Maybe you could have w-strings for Windows pathnames, that would be > *required* to end in a backslash... :-) I would think disallowing them would be ok since we already have the single quotes in double quotes etc. method and concatenating strings. Combining the two features you can create any possible string while using no escaped quotes. r'a double(") ' r"and a single(') in one r-string with no esc" Does anyone have a problem with me removing escaped quotes from r-strings for completeness and consistency? Comments? Votes?