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: