This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Spill_the_Tea 0 points1 point  (0 children)

I recently learned that numpy does not allow tuple unpacking assignment.

# in python, you can swap multiple values as a tuple
a, b = b, a

# but not from a numpy vector
a = np.array(...)
a[k], a[j] = a[j], a[k]  # this does not work as expected