summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-02-19 13:56:17 (GMT)
committerGeorg Brandl <georg@python.org>2006-02-19 13:56:17 (GMT)
commit67e9fb9d7afbd9935322420a7cadd4cb6538dcdf (patch)
tree2d6905f185cfca51ba3d9462882935c35a01b4fb /Doc/lib
parent602b9ba6b37c4ac4ed445f8c9e9dccd68d631899 (diff)
downloadcpython-67e9fb9d7afbd9935322420a7cadd4cb6538dcdf.zip
cpython-67e9fb9d7afbd9935322420a7cadd4cb6538dcdf.tar.gz
cpython-67e9fb9d7afbd9935322420a7cadd4cb6538dcdf.tar.bz2
Patch #1215184: fileinput now has a fileno() function for getting the
current file number.
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libfileinput.tex15
1 files changed, 11 insertions, 4 deletions
diff --git a/Doc/lib/libfileinput.tex b/Doc/lib/libfileinput.tex
index cd20f99..b6186dc 100644
--- a/Doc/lib/libfileinput.tex
+++ b/Doc/lib/libfileinput.tex
@@ -62,6 +62,12 @@ The following functions use the global state created by
line has been read, returns \code{None}.
\end{funcdesc}
+\begin{funcdesc}{fileno}{}
+ Return the integer ``file descriptor'' for the current file. When no
+ file is opened (before the first line and between files), returns
+ \code{-1}.
+\end{funcdesc}
+
\begin{funcdesc}{lineno}{}
Return the cumulative line number of the line that has just been
read. Before the first line has been read, returns \code{0}. After
@@ -107,10 +113,11 @@ module is available for subclassing as well:
\begin{classdesc}{FileInput}{\optional{files\optional{,
inplace\optional{, backup}}}}
Class \class{FileInput} is the implementation; its methods
- \method{filename()}, \method{lineno()}, \method{fileline()},
- \method{isfirstline()}, \method{isstdin()}, \method{nextfile()} and
- \method{close()} correspond to the functions of the same name in the
- module. In addition it has a \method{readline()} method which
+ \method{filename()}, \method{fileno()}, \method{lineno()},
+ \method{fileline()}, \method{isfirstline()}, \method{isstdin()},
+ \method{nextfile()} and \method{close()} correspond to the functions
+ of the same name in the module.
+ In addition it has a \method{readline()} method which
returns the next input line, and a \method{__getitem__()} method
which implements the sequence behavior. The sequence must be
accessed in strictly sequential order; random access and