Python's driving me mad. Invalid token?
Bengt Richter
bokr at oz.net
Mon Oct 21 16:03:18 EDT 2002
On Mon, 21 Oct 2002 14:06:20 +1300, Greg Ewing <see_reply_address at something.invalid> wrote:
>Paul.Casteels at ua.ac.be wrote:
>
>>
>> \" seems to be treate as one character, r'\' also does not work.
>> You will have to use r'\\'. This is strange, because r'\a' does work as
>> expected.
>
>
>Even in a raw string, backslashes still escape quote
>characters. A consequence of this is that a raw string
>can't end in an odd number of backslashes. Which is
>annoying, but we seem to be stuck with it.
>
Why couldn't we have a simple choose-your-delimiter
really-raw-no-escapes quoting format? E.g., if the first character
after the quote were the chosen delimiter,
q'#\\\#
(with q' prefix flagging the format) would be equivalent to '\\\\\\'
BTW, please reserve upper case Q'... for something else
(which I won't go into for fear of losing focus ;-)
Regards,
Bengt Richter
More information about the Python-list
mailing list