Skip to main content

Convenient bit fields for int subclasses

Project description

# bfield.BitField

The missing bitfield type for Python 2 and 3.

## Example:

```
from bfield import BitField

class AX(int):
AL = BitField(0, 8, "The lower octet")
AH = BitField(8, 16, "The higher octet")


assert AX(0x1234).AH == 0x12
assert AX(0x1234).AL == 0x34
```

## Caveat

Note that due to specifics of immutable ints, read-only is the best thing
available. This is sufficient for decoding binary protocols and file formats.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bfield, version 0.9
Filename, size File type Python version Upload date Hashes
Filename, size bfield-0.9-py2.py3-none-any.whl (4.4 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size bfield-0.9.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page