[issue17868] pprint long non-printable bytes as hexdump

Serhiy Storchaka report at bugs.python.org
Sat May 4 14:05:21 CEST 2013


Serhiy Storchaka added the comment:

> I don't understand how it would be useful in the pprint module if it
> can't be useful as a general function.

How can it be used besides pprint/pformat functions?

>  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.

Then perhaps a new parameter for pprint/pformat needed (hex=True?). I think printing integers in hexadecimal can sometimes be useful too.

> This won't work very nicely in smaller display widths. You'll need too
> many lines to represent a bytes object.

This is a nature of hexdumps. Every byte requires 4+ characters (or 3+ if group hexdigits tighter).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17868>
_______________________________________


More information about the Python-bugs-list mailing list