I am trying to define a a class of namedtuples that contains an array, but with no success.
I have tried using np.zeros(shape=(16)) or np.empty(2, dtype = int8)
but with no success.
from typing import NamedTuple
import numpy as np
class BasicDemodStatsMsg(NamedTuple):
header: IcdHeader
field1: np.uint32
field2: np.uint32
field3: np.uint16
reserved: np.zeros(shape=(16))
checksum: np.uint16
At the end I would like to have a class that has a fixed size of bytes in the memory and can be packed and unpacked to and from byte arrays.
NamedTuple? Where does it come from?collections.namedtuplenotcollections.NamedTuple@Yarom.collections.namedtupleis a thing. The onlyNamedTupleI can think of right now istyping.NamedTupleand that is only for typing purpose.