I've got a list with row matrices:
rows = [ matrix([[1, 0, 0]]), matrix([[0, 1, 0]]), matrix([[0, 0, 1]]) ]
and I attempted to loop over these using for (a, b, c) in rows:
, but instead of this working, I got an error:
ValueError: not enough values to unpack (expected 3, got 1)
The expected behaviour would be to unpack the three elements in the row to a, b, c
:
for (a, b, c) in rows:
print(f"{a} {b} {c}")
> 1 0 0
> 0 1 0
> 0 0 1
Unfortunately, this would work on [1, 0, 0]
, but not on [[1, 0, 0]]
.
I realized this is because they're [[doubly packed]]
, but I was wondering if there was a simple solution to this issue?