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.

Source Distribution

bfield-0.9.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

bfield-0.9-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bfield-0.9.tar.gz.

File metadata

  • Download URL: bfield-0.9.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bfield-0.9.tar.gz
Algorithm Hash digest
SHA256 923e72a6ad7349f097117be5878b63e21db6aff5f5bac00f8b6a53b4844d653b
MD5 eccd6174bc8311b4dc2ccc8eb60a5843
BLAKE2b-256 2134ca80c28c05d75cbc59b9ffb3e79f686715517d36b558f3ab4848f95a3521

See more details on using hashes here.

File details

Details for the file bfield-0.9-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for bfield-0.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 359c884e56f1aaa3333a86076195dc7bfbdb9f1bf69269541594b96c023dee23
MD5 fee1ec239c8426fcdf08fd90cf4439c2
BLAKE2b-256 798fc5802af671b9bd53a52dec848ef3af6fdc36614967dd41871b6ef9cf1e9e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page