If there's no solution to this, I'll just change the list using the index. I don't want to go this route because I know I will not remember that maxpwm is list item #8 for example. The whole purpose of this is just better readability in the future because I plan on using these values in different functions to read and write.
class hwcfg:
def __init__(self, a):
self.file = a
self.minauxinput1 = a[0]
self.minauxinput2 = a[1]
self.maxauxinput = a[2]
self.vtypenstsize = a[4]
self.minpwm = a[7]
self.maxpwm = a[8]
self.mindac = a[11]
self.maxdac = a[12]
bytes = bytearray.fromhex('7F 66 02 00 3A 00 13 00 44 54 02 13 17 00 44 54 31 00 31 00 3B 0E 00 00 A2 05 00 00 00 00 59 00 59 0D 00 00 40 00 A6 01 24 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 4B')
file = bytes[16:]
integers = []
i = struct.iter_unpack('h', file)
for x in i:
integers.append(x[0])
param = hwcfg(integers)
param.maxauxinput = 1
is there a way I can write this so that setting param.maxauxinput = 1 also sets file[2] or a[2] = 1?