"Byte" type?
John Nagle
nagle at animats.com
Sun Feb 15 01:10:41 EST 2009
With "bytearray", the element type is considered to be "unsigned byte",
or so says PEP 3137: "The element data type is always 'B' (i.e. unsigned byte)."
Let's try:
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on
win32
>>> xx = b'x'
>>> repr(xx)
"'x'"
>>> repr(xx[0])
"'x'"
>>> repr(xx[0][0])
"'x'"
>>>
But that's not what "repr" indicates. The bytearray element is apparently
being promoted to "bytes" as soon as it comes out of the array.
John Nagle
More information about the Python-list
mailing list