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

Default uint type inconsistently applied. #220

Closed scott-griffiths closed 2 years ago

scott-griffiths commented 3 years ago

for the read and readlist methods (and related ones) there was a default type of uint introduced back in 2009. This doesn't appear to have been consistently applied though:

>>> s = BitStream('0x1100')
>>> s.read('4')
1
>> s.read(4)
BitStream('0x1')

You do have the options of using s.read('bits:4') if you want a new bitstring, but not having uint as a special case is a cleaner interface.

I think the best course is to remove the uint default interpretation and return a bitstring in both cases. It's a breaking change though so will have to wait for 3.2. Docs need updating too.

scott-griffiths commented 2 years ago

Fixed in commit 57f59c714f9