[issue17530] pprint could use line continuation for long bytes literals

Pam McA'Nulty report at bugs.python.org
Mon Apr 15 15:52:23 CEST 2013


Pam McA'Nulty added the comment:

Here's a patch.  I needed to handle the fact that the repr of a single byte can be 1, 2 or 4 characters long and did not want to wrap in the middle of a byte representation.  Note also that bytes literals require a continuation character.  In the pathological case where the wrap size is smaller than the representation of a single byte, I chose to always print at least one byte per line.

As an aside, I also replaced the str wrapping code's calls to len with the cached _len used in the rest of pprint.py

----------
keywords: +patch
nosy: +Pam.McANulty
Added file: http://bugs.python.org/file29865/bytes_pprint.patch

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


More information about the Python-bugs-list mailing list