I got curious after the discussion taking place on this question. It appears that the behavior of bytes()
has changed in python3. In the docs for py3 it is now listed as a built-in function that behaves the same as bytearray()
except for the result being immutable. It doesn't appear in the same place in py2 docs.
In digging thru the docs for a while I couldn't really find anything detailing what's changed from 2 to 3, but it looks like something definitely has. What's the difference and why was it changed?
From the linked question in the comments someone remarked with respect to py3
bytes(1) returns b'00'
but in 2.7.5
>>> bytes(1)
'1'