[Python-Dev] Why does read() return bytes instead of bytearray?

R. David Murray rdmurray at bitdance.com
Wed Apr 15 16:42:33 CEST 2009


On Tue, 14 Apr 2009 at 22:05, Dan Eloff wrote:
>> No, the read() method did not change from the 2.x series. It returns a new object on each call.
>
> I think you misunderstand me, but the readinto() method looks like a
> perfectly reasonable solution, I didn't realize it existed, as it's
> not in the library reference on file objects. Thanks for enlightening
> me, I feel a little stupid now :)

You have to follow the link from that section to the 'io' module to find
it.

The io module is about streams and is therefore in the 'generic operating
system services' section, not the 'file and directory access section',
which makes it a little harder to find when what you think you want to
know about is file access...I think this is a doc bug but I'm completely
unsure what would be a good fix.

--David


More information about the Python-Dev mailing list