From 343ad7a572b8cd4c877f6db6e927e3104e6d65a4 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Fri, 22 Sep 2000 04:12:27 +0000 Subject: Correct some bitrot; some things have become inaccurate in the tutorial. .readlines() does not call .readline() internally anymore, and the sizehint parameter should be mentioned briefly. Some displays of floating point numbers needed to be updated due to the change in the repr() of floats (from 1.6). Both issues were noted by Aahz . --- Doc/tut/tut.tex | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex index 0378ba4..6927afe 100644 --- a/Doc/tut/tut.tex +++ b/Doc/tut/tut.tex @@ -488,11 +488,11 @@ example: >>> tax = 17.5 / 100 >>> price = 3.50 >>> price * tax -0.6125 +0.61249999999999993 >>> price + _ -4.1125 +4.1124999999999998 >>> round(_, 2) -4.11 +4.1100000000000003 \end{verbatim} This variable should be treated as read-only by the user. Don't @@ -2780,8 +2780,12 @@ string containing only a single newline. '' \end{verbatim} -\code{f.readlines()} uses \code{f.readline()} repeatedly, and returns -a list containing all the lines of data in the file. +\code{f.readlines()} returns a list containing all the lines of data +in the file. If given an optional parameter \var{sizehint}, it reads +that many bytes from the file and enough more to complete a line, and +returns the lines from that. This is often used to allow efficient +reading of a large file by lines, but without having to load the +entire file in memory. Only complete lines will be returned. \begin{verbatim} >>> f.readlines() -- cgit v0.12