A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-checkins/2000-September/013614.html below:

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

[Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.35,1.36Fred L. Drake python-dev@python.org
Tue, 19 Sep 2000 08:18:54 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19715/lib

Modified Files:
	libstdtypes.tex 
Log Message:

Clarify a number of issues about the file-like object API based on
discussion on python-dev.


Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** libstdtypes.tex	2000/09/14 20:24:17	1.35
--- libstdtypes.tex	2000/09/19 15:18:51	1.36
***************
*** 996,1016 ****
  \begin{methoddesc}[file]{close}{}
    Close the file.  A closed file cannot be read or written anymore.
  \end{methoddesc}
  
  \begin{methoddesc}[file]{flush}{}
!   Flush the internal buffer, like \code{stdio}'s \cfunction{fflush()}.
  \end{methoddesc}
  
  \begin{methoddesc}[file]{isatty}{}
!   Return \code{1} if the file is connected to a tty(-like) device, else
!   \code{0}.
  \end{methoddesc}
  
  \begin{methoddesc}[file]{fileno}{}
! Return the integer ``file descriptor'' that is used by the underlying
! implementation to request I/O operations from the operating system.
! This can be useful for other, lower level interfaces that use file
! descriptors, e.g. module \module{fcntl} or \function{os.read()} and friends.
! \refbimodindex{fcntl}
  \end{methoddesc}
  
--- 996,1026 ----
  \begin{methoddesc}[file]{close}{}
    Close the file.  A closed file cannot be read or written anymore.
+   Any operation which requires that the file be open will raise an
+   \exception{IOError} after the file has been closed.  Calling
+   \method{close()} more than once is allowed.
  \end{methoddesc}
  
  \begin{methoddesc}[file]{flush}{}
!   Flush the internal buffer, like \code{stdio}'s
!   \cfunction{fflush()}.  This may be a no-op on some file-like
!   objects.
  \end{methoddesc}
  
  \begin{methoddesc}[file]{isatty}{}
!   Return true if the file is connected to a tty(-like) device, else
!   false.  \strong{Note:} If a file-like object is not associated
!   with a real file, this method should \emph{not} be implemented.
  \end{methoddesc}
  
  \begin{methoddesc}[file]{fileno}{}
!   \index{file descriptor}
!   \index{descriptor, file}
!   Return the integer ``file descriptor'' that is used by the
!   underlying implementation to request I/O operations from the
!   operating system.  This can be useful for other, lower level
!   interfaces that use file descriptors, e.g.\ module
!   \refmodule{fcntl}\refbimodindex{fcntl} or \function{os.read()} and
!   friends.  \strong{Note:} File-like objects which do not have a real
!   file descriptor should \emph{not} provide this method!
  \end{methoddesc}
  
***************
*** 1041,1047 ****
    newline) and an incomplete line may be returned.
    An empty string is returned when \EOF{} is hit
!   immediately.  Note: Unlike \code{stdio}'s \cfunction{fgets()}, the returned
!   string contains null characters (\code{'\e 0'}) if they occurred in the
!   input.
  \end{methoddesc}
  
--- 1051,1057 ----
    newline) and an incomplete line may be returned.
    An empty string is returned when \EOF{} is hit
!   immediately.  Note: Unlike \code{stdio}'s \cfunction{fgets()}, the
!   returned string contains null characters (\code{'\e 0'}) if they
!   occurred in the input.
  \end{methoddesc}
  
***************
*** 1051,1055 ****
    present, instead of reading up to \EOF{}, whole lines totalling
    approximately \var{sizehint} bytes (possibly after rounding up to an
!   internal buffer size) are read.
  \end{methoddesc}
  
--- 1061,1067 ----
    present, instead of reading up to \EOF{}, whole lines totalling
    approximately \var{sizehint} bytes (possibly after rounding up to an
!   internal buffer size) are read.  Objects implementing a file-like
!   interface may choose to ignore \var{sizehint} if it cannot be
!   implemented, or cannot be implemented efficiently.
  \end{methoddesc}
  
***************
*** 1068,1076 ****
  
  \begin{methoddesc}[file]{truncate}{\optional{size}}
! Truncate the file's size.  If the optional size argument present, the
! file is truncated to (at most) that size.  The size defaults to the
! current position.  Availability of this function depends on the
! operating system version (for example, not all \UNIX{} versions support this
! operation).
  \end{methoddesc}
  
--- 1080,1088 ----
  
  \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 of this function
!   depends on the operating system version (for example, not all
!   \UNIX{} versions support this operation).
  \end{methoddesc}
  
***************
*** 1088,1096 ****
  
  
! File objects also offer the following attributes:
  
  \begin{memberdesc}[file]{closed}
  Boolean indicating the current state of the file object.  This is a
  read-only attribute; the \method{close()} method changes the value.
  \end{memberdesc}
  
--- 1100,1111 ----
  
  
! File objects also offer a number of other interesting attributes.
! These are not required for file-like objects, but should be
! implemented if they make sense for the particular object.
  
  \begin{memberdesc}[file]{closed}
  Boolean indicating the current state of the file object.  This is a
  read-only attribute; the \method{close()} method changes the value.
+ It may not be available on all file-like objects.
  \end{memberdesc}
  
***************
*** 1098,1102 ****
  The I/O mode for the file.  If the file was created using the
  \function{open()} built-in function, this will be the value of the
! \var{mode} parameter.  This is a read-only attribute.
  \end{memberdesc}
  
--- 1113,1118 ----
  The I/O mode for the file.  If the file was created using the
  \function{open()} built-in function, this will be the value of the
! \var{mode} parameter.  This is a read-only attribute and may not be
! present on all file-like objects.
  \end{memberdesc}
  
***************
*** 1105,1109 ****
  the file.  Otherwise, some string that indicates the source of the
  file object, of the form \samp{<\mbox{\ldots}>}.  This is a read-only
! attribute.
  \end{memberdesc}
  
--- 1121,1125 ----
  the file.  Otherwise, some string that indicates the source of the
  file object, of the form \samp{<\mbox{\ldots}>}.  This is a read-only
! attribute and may not be present on all file-like objects.
  \end{memberdesc}
  



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4