Rather than bikeshedding, why not implement the common formats and
flags implemented by the venerable 'od' command? It's been
time-tested...
On Sat, May 12, 2012 at 9:20 AM, Floris Bruynooghe
On 12 May 2012 09:59, anatoly techtonik
wrote: hexdump(bytes) - produce human readable dump of binary data,
+1 on this basic function, that would be very nice in the stdlib. Now I always need to go and dig up my own function from somewhere.
A certain deal of bikeshedding would be required on the function signature however, I'd go with something like:
hexdump(data, rowsize=16, offsets=True, ascii=True)
Where rowsize is the number of bytes on one row, offsets controls showing the byte number (in hex) of the first byte of each row and ascii controls showing the 7-bit printable characters in a right hand column.
This would cover my needs, I'm sure other people will come up with more must-haves.
Regards, Floris
-- Debian GNU/Linux -- The Power of Freedom www.debian.org | www.gnu.org | www.kernel.org _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)