This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients ezio.melotti, pitrou, serhiy.storchaka, techtonik
Date 2013-05-04.11:17:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367666241.2570.4.camel@fsol>
In-reply-to <1367660578.42.0.494949959363.issue17868@psf.upfronthosting.co.za>
Content
Le samedi 04 mai 2013 à 09:42 +0000, Serhiy Storchaka a écrit :
> 
> However a simple specialized code can be used for special purposes,
> i.e. internally in the pprint module. I don't see how it can be reused
> and don't interested in a general function.

I don't understand how it would be useful in the pprint module if it
can't be useful as a general function. The general intent is the same:
print something in a "nice" way. Just the nice way is different
depending on the situations: if my bytes object is simply a bunch of
HTTP headers, I don't want to have a hexdump.

> An alternative option is first output a bytes object as is (perhaps
> splitting it on multiple line as in issue17530) and then output a
> hexdamp as a comment.
> 
> [b'\x7fELF\x01\x01\x01\x00\x00\n'
>  b'\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00\x01'
>  # 7F 45 4C 46 01 01 01 00 00 0A 00 00 00 00 00 00 | .ELF............
>  # 02 00 03 00 01                                  | .....
>  ]

This won't work very nicely in smaller display widths. You'll need too
many lines to represent a bytes object.
History
Date User Action Args
2013-05-04 11:17:24pitrousetrecipients: + pitrou, techtonik, ezio.melotti, serhiy.storchaka
2013-05-04 11:17:24pitroulinkissue17868 messages
2013-05-04 11:17:23pitroucreate