diff options
author | Guido van Rossum <guido@python.org> | 1997-07-17 16:05:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-07-17 16:05:47 (GMT) |
commit | 6c9db41d301ddd62b0d82fefe835205c8ff356b8 (patch) | |
tree | 0a1281c4ef25290a831498a0dc321b36b7e324a2 /Doc | |
parent | debf2e8a5378a5eb5783297b0027331398f450e9 (diff) | |
download | cpython-6c9db41d301ddd62b0d82fefe835205c8ff356b8.zip cpython-6c9db41d301ddd62b0d82fefe835205c8ff356b8.tar.gz cpython-6c9db41d301ddd62b0d82fefe835205c8ff356b8.tar.bz2 |
Added fileno(); added readlines(sizehint).
AMK's sed job.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libtypes.tex | 33 | ||||
-rw-r--r-- | Doc/libtypes.tex | 33 |
2 files changed, 48 insertions, 18 deletions
diff --git a/Doc/lib/libtypes.tex b/Doc/lib/libtypes.tex index 6bbedce..e040c3a 100644 --- a/Doc/lib/libtypes.tex +++ b/Doc/lib/libtypes.tex @@ -405,13 +405,13 @@ If the right argument is a dictionary (or any kind of mapping), then the formats in the string must have a parenthesized key into that dictionary inserted immediately after the \code{\%} character, and each format formats the corresponding entry from the mapping. E.g. -\begin{verbatim} - >>> count = 2 - >>> language = 'Python' - >>> print '%(language)s has %(count)03d quote types.' % vars() - Python has 002 quote types. - >>> -\end{verbatim} +\bcode\begin{verbatim} +>>> count = 2 +>>> language = 'Python' +>>> print '%(language)s has %(count)03d quote types.' % vars() +Python has 002 quote types. +>>> +\end{verbatim}\ecode In this case no * specifiers may occur in a format (since they require a sequential parameter list). @@ -685,6 +685,13 @@ Files have the following methods: \code{0}. \end{funcdesc} +\begin{funcdesc}{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 \code{fcntl} or \code{os.read} and friends. +\end{funcdesc} + \begin{funcdesc}{read}{\optional{size}} Read at most \var{size} bytes from the file (less if the read hits \EOF{} or no more data is immediately available on a pipe, tty or @@ -714,9 +721,11 @@ Files have the following methods: input. \end{funcdesc} -\begin{funcdesc}{readlines}{} +\begin{funcdesc}{readlines}{\optional{sizehint}} Read until \EOF{} using \code{readline()} and return a list containing - the lines thus read. + the lines thus read. If the optional \var{bufferhint} argument is + present, instead of reading up to \EOF{}, whole lines totalling + approximately \var{sizehint} bytes are read. \end{funcdesc} \begin{funcdesc}{seek}{offset\, whence} @@ -751,6 +760,12 @@ Write a list of strings to the file. There is no return value. does not add line separators.) \end{funcdesc} +Classes that are trying to simulate a file object should also have a +writable \code{softspace} attribute, which should be initialized to +zero. (\code{softspace} is used by the \code{print} statement.) This +will be automatic for classes implemented in Python; types implemented +in C will have to provide a writable \code{softspace} attribute. + \subsubsection{Internal Objects} (See the Python Reference Manual for these.) diff --git a/Doc/libtypes.tex b/Doc/libtypes.tex index 6bbedce..e040c3a 100644 --- a/Doc/libtypes.tex +++ b/Doc/libtypes.tex @@ -405,13 +405,13 @@ If the right argument is a dictionary (or any kind of mapping), then the formats in the string must have a parenthesized key into that dictionary inserted immediately after the \code{\%} character, and each format formats the corresponding entry from the mapping. E.g. -\begin{verbatim} - >>> count = 2 - >>> language = 'Python' - >>> print '%(language)s has %(count)03d quote types.' % vars() - Python has 002 quote types. - >>> -\end{verbatim} +\bcode\begin{verbatim} +>>> count = 2 +>>> language = 'Python' +>>> print '%(language)s has %(count)03d quote types.' % vars() +Python has 002 quote types. +>>> +\end{verbatim}\ecode In this case no * specifiers may occur in a format (since they require a sequential parameter list). @@ -685,6 +685,13 @@ Files have the following methods: \code{0}. \end{funcdesc} +\begin{funcdesc}{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 \code{fcntl} or \code{os.read} and friends. +\end{funcdesc} + \begin{funcdesc}{read}{\optional{size}} Read at most \var{size} bytes from the file (less if the read hits \EOF{} or no more data is immediately available on a pipe, tty or @@ -714,9 +721,11 @@ Files have the following methods: input. \end{funcdesc} -\begin{funcdesc}{readlines}{} +\begin{funcdesc}{readlines}{\optional{sizehint}} Read until \EOF{} using \code{readline()} and return a list containing - the lines thus read. + the lines thus read. If the optional \var{bufferhint} argument is + present, instead of reading up to \EOF{}, whole lines totalling + approximately \var{sizehint} bytes are read. \end{funcdesc} \begin{funcdesc}{seek}{offset\, whence} @@ -751,6 +760,12 @@ Write a list of strings to the file. There is no return value. does not add line separators.) \end{funcdesc} +Classes that are trying to simulate a file object should also have a +writable \code{softspace} attribute, which should be initialized to +zero. (\code{softspace} is used by the \code{print} statement.) This +will be automatic for classes implemented in Python; types implemented +in C will have to provide a writable \code{softspace} attribute. + \subsubsection{Internal Objects} (See the Python Reference Manual for these.) |