what is wrong with that r"\"
Matthieu TC
matthieutc at yahoo.com
Wed Jul 4 08:15:24 EDT 2007
May I suggest giving the possibility to use any delimiter for a raw string? just like in Vi or ruby.
Vi:
%s_a_b_g is valid and so is %s/a/b/g
Ruby:
%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.
-matt
----- 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!? ::
re.compile(r''''"''')
Ah, I see -- readability is the problem. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list