[Python-Dev] Readability of hex strings (Was: Use of coding cookie in 3.x stdlib)

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jul 27 09:45:25 CEST 2010


anatoly techtonik wrote:
> I wonder if it is possible to introduce an effective binary string
> type that will be represented as h"XX XX XX" in language syntax?

Rather than a new type, maybe bytes objects could just have
a bit indicating whether they were best thought of as containing
characterish stuff or just raw data. It wouldn't affect the
behaviour in any way except that the repr would come out in
hex instead of text.

Then b"..." and h"..." literals could produce bytes objects
with different settings for the raw-data bit.

-- 
Greg


More information about the Python-Dev mailing list