[Python-ideas] Stop displaying elements of bytes objects as printable ASCII characters in CPython 3

Terry Reedy tjreedy at udel.edu
Wed Sep 10 10:11:28 CEST 2014


I agree with Chris Lasher's basic point, that the representation of 
bytes confusingly contradicts the idea that bytes are bytes.  But it is 
not going to change.

On 9/10/2014 3:56 AM, Cory Benfield wrote:
> On 10 September 2014 08:45, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> memoryview.cast can be a potentially useful tool for that :)
>
> Sure, and so can binascii.hexlify (which is what I normally use).

See http://bugs.python.org/issue9951 to add bytes.hex or .tohex as more 
of less the inverse of bytes.fromhex or even have hex(bytes) work.  This 
change *is* possible and I think we should pick one of the suggestions 
for 3.5.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list