[Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.82,1.83

Tim Peters tim_one@users.sourceforge.net
Mon, 11 Mar 2002 19:04:46 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv17165/python/Doc/lib

Modified Files:
	libstdtypes.tex 
Log Message:
Change Windows file.truncate() to (a) restore the original file position,
and (b) stop trying to prevent file growth.

Beef up the file.truncate() docs.

Change test_largefile.py to stop assuming that f.truncate() moves the
file pointer to the truncation point, and to verify instead that it leaves
the file position alone.  Remove the test for what happens when a
specified size exceeds the original file size (it's ill-defined, according
to the Single Unix Spec).


Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -d -r1.82 -r1.83
*** libstdtypes.tex	11 Mar 2002 00:24:00 -0000	1.82
--- libstdtypes.tex	12 Mar 2002 03:04:44 -0000	1.83
***************
*** 162,166 ****
  \subsection{Numeric Types \label{typesnumeric}}
  
! There are four numeric types: \dfn{plain integers}, \dfn{long integers}, 
  \dfn{floating point numbers}, and \dfn{complex numbers}.
  Plain integers (also just called \dfn{integers})
--- 162,166 ----
  \subsection{Numeric Types \label{typesnumeric}}
  
! There are four numeric types: \dfn{plain integers}, \dfn{long integers},
  \dfn{floating point numbers}, and \dfn{complex numbers}.
  Plain integers (also just called \dfn{integers})
***************
*** 179,183 ****
  Complex numbers have a real and imaginary part, which are both
  implemented using \ctype{double} in C.  To extract these parts from
! a complex number \var{z}, use \code{\var{z}.real} and \code{\var{z}.imag}.  
  
  Numbers are created by numeric literals or as the result of built-in
--- 179,183 ----
  Complex numbers have a real and imaginary part, which are both
  implemented using \ctype{double} in C.  To extract these parts from
! a complex number \var{z}, use \code{\var{z}.real} and \code{\var{z}.imag}.
  
  Numbers are created by numeric literals or as the result of built-in
***************
*** 249,253 ****
  \item[(1)]
  For (plain or long) integer division, the result is an integer.
! The result is always rounded towards minus infinity: 1/2 is 0, 
  (-1)/2 is -1, 1/(-2) is -1, and (-1)/(-2) is 0.  Note that the result
  is a long integer if either operand is a long integer, regardless of
--- 249,253 ----
  \item[(1)]
  For (plain or long) integer division, the result is an integer.
! The result is always rounded towards minus infinity: 1/2 is 0,
  (-1)/2 is -1, 1/(-2) is -1, and (-1)/(-2) is 0.  Note that the result
  is a long integer if either operand is a long integer, regardless of
***************
*** 473,477 ****
    \code{len(\var{s}) + \var{j}} is substituted.  But note that \code{-0} is
    still \code{0}.
!   
  \item[(3)] The slice of \var{s} from \var{i} to \var{j} is defined as
    the sequence of items with index \var{k} such that \code{\var{i} <=
--- 473,477 ----
    \code{len(\var{s}) + \var{j}} is substituted.  But note that \code{-0} is
    still \code{0}.
! 
  \item[(3)] The slice of \var{s} from \var{i} to \var{j} is defined as
    the sequence of items with index \var{k} such that \code{\var{i} <=
***************
*** 809,813 ****
  Additional string operations are defined in standard modules
  \refmodule{string}\refstmodindex{string} and
! \refmodule{re}.\refstmodindex{re} 
  
  
--- 809,813 ----
  Additional string operations are defined in standard modules
  \refmodule{string}\refstmodindex{string} and
! \refmodule{re}.\refstmodindex{re}
  
  
***************
*** 882,886 ****
    deprecated since Python 1.4.
  
! \item[(2)] Raises an exception when \var{x} is not a list object.  The 
    \method{extend()} method is experimental and not supported by
    mutable sequence types other than lists.
--- 882,886 ----
    deprecated since Python 1.4.
  
! \item[(2)] Raises an exception when \var{x} is not a list object.  The
    \method{extend()} method is experimental and not supported by
    mutable sequence types other than lists.
***************
*** 1035,1039 ****
  File objects\obindex{file} are implemented using C's \code{stdio}
  package and can be created with the built-in constructor
! \function{file()}\bifuncindex{file} described in section 
  \ref{built-in-funcs}, ``Built-in Functions.''\footnote{\function{file()}
  is new in Python 2.2.  The older built-in \function{open()} is an
--- 1035,1039 ----
  File objects\obindex{file} are implemented using C's \code{stdio}
  package and can be created with the built-in constructor
! \function{file()}\bifuncindex{file} described in section
  \ref{built-in-funcs}, ``Built-in Functions.''\footnote{\function{file()}
  is new in Python 2.2.  The older built-in \function{open()} is an
***************
*** 1101,1108 ****
    Read one entire line from the file.  A trailing newline character is
    kept in the string\footnote{
! 	The advantage of leaving the newline on is that an empty string 
! 	can be returned to mean \EOF{} without being ambiguous.  Another 
! 	advantage is that (in cases where it might matter, for example. if you 
! 	want to make an exact copy of a file while scanning its lines) 
  	you can tell whether the last line of a file ended in a newline
  	or not (yes this happens!).
--- 1101,1108 ----
    Read one entire line from the file.  A trailing newline character is
    kept in the string\footnote{
! 	The advantage of leaving the newline on is that an empty string
! 	can be returned to mean \EOF{} without being ambiguous.  Another
! 	advantage is that (in cases where it might matter, for example. if you
! 	want to make an exact copy of a file while scanning its lines)
  	you can tell whether the last line of a file ended in a newline
  	or not (yes this happens!).
***************
*** 1153,1159 ****
  
  \begin{methoddesc}[file]{truncate}{\optional{size}}
!   Truncate the file's size.  If the optional \var{size} argument
    present, the file is truncated to (at most) that size.  The size
!   defaults to the current position.
    Availability:  Windows, many \UNIX variants.
  \end{methoddesc}
--- 1153,1164 ----
  
  \begin{methoddesc}[file]{truncate}{\optional{size}}
!   Truncate the file's size.  If the optional \var{size} argument is
    present, the file is truncated to (at most) that size.  The size
!   defaults to the current position.  The current file position is
!   not changed.  Note that if a specified size exceeds the file's
!   current size, the result is platform-dependent:  possibilities
!   include that file may remain unchanged, increase to the specified
!   size as if zero-filled, or increase to the specified size with
!   undefined new content.
    Availability:  Windows, many \UNIX variants.
  \end{methoddesc}