I have the following function:
def get_cofactors_matrix(self) -> 'Matrix':
"""Returns the cofactors matrix"""
cofactors = [list(map(lambda x: x[1] * x[2], [self.get_cofactor_at(i, j) for j in range(self.get_columns_count())])) for i in range(self.get_lines_count())]
...
I would like to simplify the list comprehension, the get_cofactor_at(line, column)
return a tuple of 3 values so without using list comprehension this code can be expressed in the following way:
result = []
for i in range(lines):
result_line = []
for j in range(columns):
_, x, y = self.get_cofactor_at(i, j)
result_line.append(x * y)
result.append(result_line)
What would be a better expression ?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…