[Python-checkins] python/dist/src/Doc/lib libdoctest.tex,1.19,1.20
loewis at users.sourceforge.net
loewis at users.sourceforge.net
Mon May 31 15:01:02 EDT 2004
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2601/Doc/lib
Modified Files:
libdoctest.tex
Log Message:
Patch #932930: suggest the use of rawstrings for backslashes.
Index: libdoctest.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** libdoctest.tex 27 Nov 2003 19:48:03 -0000 1.19
--- libdoctest.tex 31 May 2004 19:00:59 -0000 1.20
***************
*** 362,376 ****
tracebacks are captured via a different means).
! \item If you continue a line via backslashing in an interactive session, or
! for any other reason use a backslash, you need to double the backslash in
! the docstring version. This is simply because you're in a string, and so
! the backslash must be escaped for it to survive intact. Like:
\begin{verbatim}
! >>> if "yes" == \\
! ... "y" + \\
! ... "es":
! ... print 'yes'
! yes
\end{verbatim}
--- 362,387 ----
tracebacks are captured via a different means).
! \item If you continue a line via backslashing in an interactive session,
! or for any other reason use a backslash, you should use a raw
! docstring, which will preserve your backslahses exactly as you type
! them:
\begin{verbatim}
! >>> def f(x):
! ... r'''Backslashes in a raw docstring: m\n'''
! >>> print f.__doc__
! Backslashes in a raw docstring: m\n
! \end{verbatim}
!
! Otherwise, the backslash will be interpreted as part of the string.
! E.g., the "\textbackslash" above would be interpreted as a newline
! character. Alternatively, you can double each backslash in the
! doctest version (and not use a raw string):
!
! \begin{verbatim}
! >>> def f(x):
! ... '''Backslashes in a raw docstring: m\\n'''
! >>> print f.__doc__
! Backslashes in a raw docstring: m\n
\end{verbatim}
More information about the Python-checkins
mailing list