[Python-Dev] Why does read() return bytes instead of bytearray? (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu Apr 16 01:16:29 CEST 2009
- Previous message: [Python-Dev] Why does read() return bytes instead of bytearray?
- Next message: [Python-Dev] IDLE timeout.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Lisandro Dalcin <dalcinl gmail.com> writes:
However, your original question is still valid ... Why a binary read() returns an immutable type?
Because bytes is the standard type for holding binary data. Bytearray should only be used when there's a real, measured performance advantage doing so (which, IMHO, is rarer than you think). An immutable type makes daily programming much less error-prone.
Regards
Antoine.
- Previous message: [Python-Dev] Why does read() return bytes instead of bytearray?
- Next message: [Python-Dev] IDLE timeout.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]