Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 04 Jul 2007 11:21:14 +0000, Neil Cerutti wrote: > > > 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"'\"") > > Where's the problem!? :: > > re.compile(r''''"''') > > Ah, I see -- readability is the problem. :-)
Actually the problem is that those backslashes don't actually disappear thus producing non-intuititive behaviour. The example you provided produces a different result to Neil's result. >>> r"'\"" '\'\\"' >>> r''''"''' '\'"' >>> Neil is correct in saying that his example works for regexp matching though, as the regexp matcher understands \" as being the same as ". So r"" strings work well as Regexp-strings but not so well as Raw-strings IMHO. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list