On 2007-07-04, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
>>     String quotes can be escaped with a backslash, but the
>>     backslash remains in the string; for example, r"\"" is a
>>     valid string literal consisting of two characters: a
>>     backslash and a double quote;
>
> a) That is weird!  Why would you ever want to do that - ie
> insert \" into your string as a special case?  If I wanted a "
> in a raw string then I'd use a r'' string or a triple quoted
> string.
>
> If we removed a) then we could remove b) also and r"" strings
> would work as everyone expects.
>
> Does anyone know the justification for a)?  Maybe we should
> remove it in py3k?

If the escaped quotes didn't function in raw strings, I'd be
unable to construct (with a single notation) a regex that
included both kinds of quotes at once.

  re.compile(r"'\"")

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to