scott-griffiths / bitstring

A Python module to help you manage your bits
https://bitstring.readthedocs.io/en/stable/index.html
MIT License
405 stars 68 forks source link

Add a .hexdump() method to BitStream? #187

Closed avishayp closed 3 years ago

avishayp commented 5 years ago

First, thanks for this very useful library!

I believe hexdump is a de-facto standard when it comes to printing streams of bytes, and as such should be part of bitstring. If that sounds like a good idea, I'd provide the PR.

felixdivo commented 3 years ago

Couldn't one just use the hexdump library? For example (didn't actually run it):

from hexdump import hexdump
from bitstring import BitStream

hexdump(BitStream(b"hey").tobytes())
scott-griffiths commented 3 years ago

Yes, I agree that it's better to keep things separate, especially when it is so easy to just get the bytes out (either with the tobytes() method or the bytes property). That works fine for me - to be honest I'd never used hexdump, but it does look useful.