Message188352
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. |
|
Date |
User |
Action |
Args |
2013-05-04 11:17:24 | pitrou | set | recipients:
+ pitrou, techtonik, ezio.melotti, serhiy.storchaka |
2013-05-04 11:17:24 | pitrou | link | issue17868 messages |
2013-05-04 11:17:23 | pitrou | create | |
|