[Python-Dev] s/bytes/octet/ [Was:Re: bytes.from_hex() [Was: PEP 332 revival in coordination with pep 349?]]

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 21 10:50:56 CET 2006


Ron Adam wrote:

> Storing byte information as 16 or 32 bits ints could take up a rather 
> lot of memory in some cases.

I don't quite see the point here. Inside a bytes object,
they would be stored 1 byte per byte. Nobody is suggesting
that they would take up more than that just because
a_bytes_object[i] happens to return an int.

So the only reason to introduce a new "byte" type is to
remove some of the operations that int has. We can already
do bitwise operations on an int, so we don't need a new
type to add that capability.

What's more, I can see this leading to people asking for
arithmetic operations to be *added* to the byte type so
they can do wrap-around arithmetic, and then for 16-bit,
32-bit, 64-bit etc. versions of it, etc. etc.

Do we really want to get onto that slope?

Greg


More information about the Python-Dev mailing list