Skip to main content

The missing bitfield type for Python 2 and 3.

Example

The following example illustrates possible use of bfield:

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.

Release files for bfield 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bfield 0.9.1
File Size Uploaded
bfield-0.9.1.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bfield 0.9.1
File Interpreter ABI Platform
bfield-0.9.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 8.9 kB

Release files / bfield-0.9.1.tar.gz

Download URL bfield-0.9.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3c29dd9a2130da2aff7ac326d977aeba6b533b3c3845034fd4c68744a5effa2c
BLAKE2b-256 checksum
How to use checksums
9bc39fa89f125a6daa4ea809e3d486066f9006a78636dd8177cbfe47f78d7572
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / bfield-0.9.1-py2.py3-none-any.whl

Download URL bfield-0.9.1-py2.py3-none-any.whl
Size 4.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
fab4a1736be1900e81ba1f7ed72476ef9fac42e6e4d41266b6c537f55c907931
BLAKE2b-256 checksum
How to use checksums
14a2199f043d601e094aa78760a01df3cfbe1b089d2ef42adb143bc4b7036c6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page