741fc41f070cc59574db6436a2b53e6213c3a1f6
list() always used MSB-first bit order regardless of the msb_last constructor flag, so indexing/slicing on an instance built with msb_last=True silently behaved identically to the default -- the documented "swap bit order for indexing and slicing" never happened. __setitem__ needed a matching fix: since __setvalue() always expects a MSB-first list, a mutated LSB-first list from list() has to be reversed back before being passed in. Found while wiring bits.Bits into progpib's GPIB status-byte handling (IEEE-488.2 bit numbering is LSB-first, e.g. RQS = bit 6). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Bits
Helps manage your bits!
Intended to be compatible with Python 3.6+. Written and tested against Python 3.8.5 Ubuntu 20.04.1 LTS.
If something doesn't work in Python 3.6, it's a bug. Please report any such bugs if they are encountered.
PyPI
View on PyPI at https://pypi.org/project/binary-bits/
Install from PyPI: python3 -m pip install binary-bits --upgrade
Use in your project:
import bits
my_bytes = bits.Bytes(bytes.fromhex('deadbeef'))
Similar projects
py-flags
Release 1.1.0
Latest
Languages
Python
95.7%
Shell
3.9%
Makefile
0.4%