[Python-ideas] hexdump
Yuval Greenfield
ubershmekel at gmail.com
Mon Apr 29 14:53:37 CEST 2013
On Mon, Apr 29, 2013 at 2:43 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Command-line hexdump has a bit more options and abilities, such as
> wrapping to N character width, printing an ASCII transcript beside the
> representation, etc.
>
> To support this flexibility, a module function is better than a
> codec :-)
>
I agree. I also agree that pprint is a good place for this.
Though you could:
b'asdf'.decode('hexdump80chars')
b'asdf'.decode('hexdump40chars')
b'asdf'.decode('hexdump80chars-trans')
b'asdf'.decode('hexdump40chars-trans')
Jokes aside, this makes me wonder why decode/encode work like they do. It'd
be more sensible to:
b'asdf'.decode.utf16(little_endian=True)
'asdf'.encode.utf8(bom=True)
Yuval
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130429/f942dc86/attachment.html>
More information about the Python-ideas
mailing list