raw strings and \

Alex Martelli aleaxit at yahoo.com
Sun Mar 5 11:57:32 EST 2006


<plahey at alumni.caltech.edu> wrote:

> Hi Duncan,
> 
> thanks for the reply.  I figured that this was a technical problem
> associated with the parser.
> 
> This one is going on my Python gotchas list.  It is really silly from
> an end user perspective to have \ not special in raw strings _except_
> if it is the last character.

The alternative would have been to offer no way at all for a rawstring
to include its quoting-character. Since rawstrings were designed to
support regular expressions (which never need to end with a backslash),
that was considered a higher cost -- there is no real advantage to
supporting backslash-using Dos/Windows path literals, even though many
Windowsers use rawstrings for those.


Alex



More information about the Python-list mailing list