On Sat, Aug 10, 2019 at 12:10:55PM -0700, Glenn Linderman wrote:
Or invent "really raw" in some spelling, such as rr"c:\directory\" or e for exact, or x for exact, or <your favorite character here>"c:\directory\"
And that brings me to the thought that if \e wants to become an escape for escape, that maybe there should be an "extended escape" prefix... if you want to use more escapes, define ee"string where \\ can only be used as an escape or escaped character, \e means the ASCII escape character, and \ followed by a character with no escape definition would be an error."
Please no. We already have b-strings, r-strings, u-strings, f-strings, br-strings, rb-strings, fr-strings, rf-strings, each of which comes in four varieties (single quote, double quote, triple single quote and triple double quote). Now you're talking about adding rr-strings, v-strings (Greg suggested that) and ee-strings, presumably some or all of which will need b*- and *b- or f*- and *f- varieties too. If the plan to deprecate unrecognised escapes and then make them an exception goes ahead, and I expect that it will, in a few more releases this "extended escape" ee-string will be completely redundent. If \e is required, we will be able to add it to regular strings as needed, likewise for any future new escapes we might want. (If any.) And if we end up keeping the existing behaviour, oh well, we can always write \x1B instead. New escapes are a Nice To Have, not a Must Have. "Really raw" rr'' versus "nearly raw" r'' is a source of confusion just waiting to happen, when people use the wrong numbers of r's, or are simply unclear which they should use. It's not like we have no other options: location = r'C:\directory\subdirectory' '\\' works fine. So does this: location = 'directory/subdirectory/'.replace('/', os.sep) Even better, instead of hard-coding our paths in the source code, we can read them from a config file or database. It is unfortunate that Windows is so tricky with backslashes and forwards slashes, and that it clashes with the escape character, but I'm sure that other languages which use \ for escaping haven't proliferated a four or more kinds of strings with different escaping rules in response. -- Steven