I was studying this code:
"""Processes an encoded symbol together with its coefficients."""
def consume_packet(self, coefficients, packet):
if not self.is_fully_decoded():
# add new symbol to decoder matrix and packet vector
self.coefficient_matrix[self.num_independent][0:self.num_symbols] = coefficients
self.packet_vector[self.num_independent] = packet
To help understand the two lines of code inside the if
block, I tried this:
packet = [1, 2, 4]
num_symbols = 3
coefficient_matrix = [1, 2, 4, 5, 6, 7]
coefficient_matrix[0][0:num_symbols] = packet # I think this is supposed to extract the packet
print(coefficient_matrix[0])
print(coefficient_matrix[0][0:num_symbols])
but I got an error that says int object does not support item assignment
.
Why does this happen?