29 Apr
2013
29 Apr
'13
12:53 p.m.
On Mon, Apr 29, 2013 at 2:43 PM, Antoine Pitrou
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