[Python-ideas] Stop displaying elements of bytes objects as printable ASCII characters in CPython 3
Terry Reedy
tjreedy at udel.edu
Thu Sep 11 02:31:04 CEST 2014
On 9/10/2014 7:48 PM, Cameron Simpson wrote:
> As someone who uses ASCII or more commonly UTF-8 byte sequences, I find
> the current ascii-ish default display handy. That said...
>
> On 10Sep2014 20:57, Steven D'Aprano
> <steve at pearwood.info> wrote:
>> However, I do support Terry's suggestion that bytes (and, I presume,
>> bytearray) grow some sort of easy way of displaying the bytes in hex.
>> The trouble is, what do we actually want?
>>
>> b'Abc' --> '0x416263'
>
> To my eye that is a single number expressed in base 16 and would
To mine also.
> imply an endianness. I imagine you really mean a transcription of
> the bytes in hex, with a leading 0x to indicate the transcription.
> But it is not what my eye sees.
>
> Of course, the natural transcription above implies big endianness, as is
> only right and proper:-)
>
> Why not give bytes objects a .hex method, emitting bare hex with no leading
> 0x? That would be my first approach.
The is the initial proposal of http://bugs.python.org/issue9951, which
favor.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list