Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.BitVector4 class

Four-component vector of bits

Static methods

def zero_init() -> BitVector4
Construct a zero-filled boolean vector

Methods

def all(self, /) -> bool
Whether all bits are set
def any(self, /) -> bool
Whether any bit is set
def none(self, /) -> bool
Whether no bits are set

Special methods

def __and__(self, arg0: BitVector4, /) -> BitVector4
Bitwise AND
def __bool__(self, /) -> bool
Boolean conversion
def __eq__(self, arg0: BitVector4, /) -> bool
Equality comparison
def __getitem__(self, arg0: int, /) -> bool
Bit at given position
def __getstate__(self, /) -> bytes
Dumps the in-memory representation of vector bits
def __iand__(self, arg0: BitVector4, /) -> BitVector4
Bitwise AND and assign
def __init__(self, /) -> None
Default constructor
def __init__(self, arg0: bool, /) -> None
Construct a boolean vector with one value for all fields
def __init__(self, arg0: int, /) -> None
Construct a boolean vector from segment values
def __invert__(self, /) -> BitVector4
Bitwise inversion
def __ior__(self, arg0: BitVector4, /) -> BitVector4
Bitwise OR and assign
def __ixor__(self, arg0: BitVector4, /) -> BitVector4
Bitwise XOR and assign
def __len__() -> int
Vector size. Returns 4.
def __ne__(self, arg0: BitVector4, /) -> bool
Non-equality comparison
def __or__(self, arg0: BitVector4, /) -> BitVector4
Bitwise OR
def __repr__(self, /) -> str
Object representation
def __setitem__(self, arg0: int, arg1: bool, /) -> None
Set a bit at given position
def __setstate__(self, arg0: bytes, /) -> None
Treats the data as the in-memory representation of vector bits
def __xor__(self, arg0: BitVector4, /) -> BitVector4
Bitwise XOR

Method documentation

def magnum.BitVector4.__setstate__(self, arg0: bytes, /) -> None

Treats the data as the in-memory representation of vector bits

Exceptions
ValueError If the data size doesn’t match type size