Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 343ad7a

Browse files
committed
Correct some bitrot; some things have become inaccurate in the tutorial.
<file>.readlines() does not call <file>.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 <[email protected]>.
1 parent ab79839 commit 343ad7a

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Doc/tut/tut.tex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,11 @@ \subsection{Numbers \label{numbers}}
488488
>>> tax = 17.5 / 100
489489
>>> price = 3.50
490490
>>> price * tax
491-
0.6125
491+
0.61249999999999993
492492
>>> price + _
493-
4.1125
493+
4.1124999999999998
494494
>>> round(_, 2)
495-
4.11
495+
4.1100000000000003
496496
\end{verbatim}
497497

498498
This variable should be treated as read-only by the user. Don't
@@ -2780,8 +2780,12 @@ \subsection{Methods of File Objects \label{fileMethods}}
27802780
''
27812781
\end{verbatim}
27822782
2783-
\code{f.readlines()} uses \code{f.readline()} repeatedly, and returns
2784-
a list containing all the lines of data in the file.
2783+
\code{f.readlines()} returns a list containing all the lines of data
2784+
in the file. If given an optional parameter \var{sizehint}, it reads
2785+
that many bytes from the file and enough more to complete a line, and
2786+
returns the lines from that. This is often used to allow efficient
2787+
reading of a large file by lines, but without having to load the
2788+
entire file in memory. Only complete lines will be returned.
27852789
27862790
\begin{verbatim}
27872791
>>> f.readlines()

0 commit comments

Comments
 (0)