On Fri, Aug 09, 2019 at 01:12:59PM -0700, Glenn Linderman wrote:
> The reason I never use raw strings is in the documentation, it is
> because \ still has a special meaning, and the first several times I
> felt the need for raw strings, it was for directory names that wanted to
> end with \ and couldn't.
Can you elaborate? I find it unlikely that I would ever want a docstring
that ends with a backslash:
def func():
r"""Documentation goes here...
more documentation...
ending with a Windows path that needs a trailing backslash
like this C:\directory\"""
That seems horribly contrived. Why use backslashes in the path when the
strong recommendation is to use forward slashes?
And why not solve the problem by simply moving the closing quotes to the
next line, as PEP 8 recommends?
r"""Documentation ...
C:\directory\
"""
[...]
> >Even in a raw literal, quotes can be escaped with a backslash
Indeed, they're not so much "raw" strings as only slightly blanched
strings.
--
Steven
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/Z354BLWONCWMUMFULE64MWUK4TA6PMK2/