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

Lisandro Dalcin dalcinl at gmail.com
Thu Apr 16 01:13:13 CEST 2009

On Wed, Apr 15, 2009 at 12:05 AM, Dan Eloff <dan.eloff at gmail.com> 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 :)

However, your original question is still valid ... Why a binary read()
returns an immutable type?

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the Python-Dev mailing list