
Hi, Section 7.2.1. Methods of File Objects <https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects> says To read a file’s contents, call f.read(size), which reads some quantity of
data and returns it as a string (in text mode) or bytes object (in binary mode). *size* is an optional numeric argument. When *size* is omitted or negative, the entire contents of the file will be read and returned [...]. Otherwise, at most *size* bytes are read and returned.
The problem is that it says "bytes", but in text mode, f.read(size) will return *size **characters*. It seems like this just wasn't updated since Python 2. It could be rephrased as: Otherwise, at most *size* characters (in text mode) or *size* bytes (in
binary mode) are read and returned.
By the way, the section on io.TextIOBase.read <https://docs.python.org/3/library/io.html#io.TextIOBase.read> does not have this problem. Thanks, William Andrea