read text file byte by byte

Nobody nobody at nowhere.com
Wed Dec 16 16:54:59 EST 2009


On Mon, 14 Dec 2009 21:37:33 -0300, Gabriel Genellina wrote:

>> There are no file objects in 3.x. The file() function no longer
>> exists. The return value from open(), will be an instance of
>> _io.<something> depending upon the mode, e.g. _io.TextIOWrapper for 'r',
>> _io.BufferedReader for 'rb', _io.BufferedRandom for 'w+b', etc.
>>
>> 	http://docs.python.org/3.1/library/io.html
>>
>> io.IOBase.read() doesn't exist, io.RawIOBase.read(n) reads n bytes,
>> io.TextIOBase.read(n) reads n characters.
> 
> So basically this section [1] should not exist, or be completely rewritten?

It should probably be changed to refer to "the file interface" or similar,
rather than removed altogether.

The io documentation may be unnecessary detail for many users. It would be
better to provide a more general overview, with a link to the io
package for those interested in the precise details. Also, removing the
section on "file objects" altogether is likely to be unhelpful for people
migrating from 2.x to 3.x.




More information about the Python-list mailing list