[Python-3000] Are bytes object really immutable?

Amaury Forgeot d'Arc amauryfa at gmail.com
Thu Apr 3 02:31:38 CEST 2008


On Thu, Apr 3, 2008 at 12:10 AM, Guido van Rossum <guido at python.org> wrote:
> On Wed, Apr 2, 2008 at 2:47 PM, Amaury Forgeot d'Arc <amauryfa at gmail.com> wrote:
>  > Stop me if I'm wrong, but I thought that bytes objects are immutable
>  >  (they are based on the PyStringType, after all)
>
>  Right. In 3.0a1 they were mutable, that's probably where these
>  examples come from.
>
>
>  >  But I was surprised by this code in test_socket.py::
>  >
>  >         buf = b" "*1024
>  >         nbytes = self.cli_conn.recv_into(buf)
>
>  That shouldn't work.

Filed issue2538 (with a tentative patch) about this problem.
There aren't many tests around buffers. I'll try to write some more.
Oh, and some documentation.

-- 
Amaury Forgeot d'Arc


More information about the Python-3000 mailing list