[Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.106,1.107 libstdtypes.tex,1.94,1.95
bwarsaw@sourceforge.net
bwarsaw@sourceforge.net
Wed, 22 May 2002 13:39:45 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv6684/lib
Modified Files:
libfuncs.tex libstdtypes.tex
Log Message:
Jack's documentation for the U mode character on the file()
constructor, vetted by Barry.
Index: libfuncs.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -d -r1.106 -r1.107
*** libfuncs.tex 21 May 2002 18:19:14 -0000 1.106
--- libfuncs.tex 22 May 2002 20:39:43 -0000 1.107
***************
*** 346,349 ****
--- 346,364 ----
ignored). If the file cannot be opened, \exception{IOError} is
raised.
+
+ In addition to the standard \cfunction{fopen()} values \var{mode}
+ may be \code{'U'} or \code{'rU'}. If Python is built with universal
+ newline support (the default) the file is opened as a text file, but
+ lines may be terminated by any of \code{'\e n'}, the Unix end-of-line
+ convention,
+ \code{'\e r'}, the Macintosh convention or \code{'\e r\e n'}, the Windows
+ convention. All of these external representations are seen as
+ \code{'\e n'}
+ by the Python program. If Python is built without universal newline support
+ \var{mode} \code{'U'} is the same as normal text mode. Note that
+ file objects so opened also have an attribute called
+ \member{newlines} which has a value of \code{None} (if no newlines
+ have yet been seen), \code{'\e n'}, \code{'\e r'}, \code{'\e r\e n'},
+ or a tuple containing all the newline types seen.
If \var{mode} is omitted, it defaults to \code{'r'}. When opening a
Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.94
retrieving revision 1.95
diff -C2 -d -r1.94 -r1.95
*** libstdtypes.tex 21 May 2002 18:19:15 -0000 1.94
--- libstdtypes.tex 22 May 2002 20:39:43 -0000 1.95
***************
*** 1249,1252 ****
--- 1249,1264 ----
\end{memberdesc}
+ \begin{memberdesc}[file]{newlines}
+ If Python was built with the \code{--with-universal-newlines} option
+ (the default) this read-only attribute exists, and for files opened in
+ universal newline read mode it keeps track of the types of newlines
+ encountered while reading the file. The values it can take are
+ \code{'\e r'}, \code{'\e n'}, \code{'\e r\e n'}, \code{None} (unknown,
+ no newlines read yet) or a tuple containing all the newline
+ types seen, to indicate that multiple
+ newline conventions were encountered. For files not opened in universal
+ newline read mode the value of this attribute will be \code{None}.
+ \end{memberdesc}
+
\begin{memberdesc}[file]{softspace}
Boolean that indicates whether a space character needs to be printed