Re: backslashes and r-strings r"abc"

"Mark Hahn" <[email protected]> Thu, 29 Jul 2004 08:40:07 -0700
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Lenard Lindstrom wrote:

>> No wonder I didn't understand what "Python in a nutshell" was
>> explaining. It makes no sense whatsoever.  What in the hell was
>> Guido thinking?
>>
> Regular expressions. Martin Christensen mentioned only using "r"
> strings for regular expressions. That is where I use them too. A
> backslash-quote in a pattern will match a quote in a string. And two
> backslashes are required
> to match a single backslash. Thus the even number of backslashes at
> the
> end of an "r" string rule. So "r" for "regular expression" makes
> sense; "r" for "raw" does not.

Oh, I understand now.  He is pre-checking to make sure the string will be
legal later when used in the regex.  That is kind of silly since it will be
checked again right away in the regex processing.

So our new definition is losing that regex pre-check but gaining the
flexibility of using the r-string for other purposes like windows paths.  I
think we are making the right decision.