what is wrong with that r"\"

Matthieu TC matthieutc at yahoo.com
Wed Jul 4 14:15:24 CEST 2007

May I suggest giving the possibility to use any delimiter for a raw string?  just like in Vi or ruby.

 %s_a_b_g  is valid and so is  %s/a/b/g

 %q{dj'\ks'a\'"}   or %q-dj'\ks'a\'"-

So as long as your regex does not use all the valid characters, readability is maintained.

----- Original Message ----
From: Marc 'BlackJack' Rintsch <bj_666 at gmx.net>
To: python-list at python.org
Sent: Wednesday, July 4, 2007 9:27:46 PM
Subject: Re: what is wrong with that r"\"

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!? ::


Ah, I see -- readability is the problem.  :-)

    Marc 'BlackJack' Rintsch

More information about the Python-list mailing list