Is this a bug?

Costas Menico costas at
Sat May 12 09:09:16 EDT 2001

"Fredrik Lundh" <fredrik at> wrote:

>for the full story on backslashes, see FAQ entry 6.29:
>    ...
>    If you're trying to build Windows pathnames, note that all
>    Windows system calls accept forward slashes too:
>        f = open("/mydir/file.txt") # works fine!
>    If you're trying to build a pathname for a DOS command,
>    try e.g. one of
>        dir = r"\this\is\my\dos\dir" "\\"
>        dir = r"\this\is\my\dos\dir\ "[:-1]
>        dir = \\this\\is\\my\\dos\\dir\\

Here is another interesting one I typed interactively.

... """
#>> x

To me the r'' syntax is inconsistent and works 99% of the time only.
I don't want to check if there is a BS at the end of a string and do
some magic to fix it. The r'' should be doing that for me. 

The big problem comes not when you are coding (cause you can see the
literal yourself and fix it) but when we generate Python scripts on
the fly especially in HTML pages.

I just don't understand why the parser can't be smart enough about

More information about the Python-list mailing list