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 firstname.lastname@example.org 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 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.
b'Abc'.decode('hexescapes') --> '\x41\x62\x63'
OTOH, this is really neat. And .decode('hex') for the former?
Cheers, Cameron Simpson email@example.com
It never will rain roses; when we want to have more roses we must plant more trees. - George Eliot, The Spanish Gypsy