NumPy arrays are extremely convenient for expressing many common vector and array operations. The standard notation is:
import numpy as np
v = np.array([1, 2, 3, 4])
u = np.array([0.3, 0.4, 0.5])
I have many cases where I need a lot of different short np.array
vectors and the boilerplate np.array(...)
gets in a way of clarity. What are the practical solutions people use to reduce boilerplate in these cases? Is there any Python magic to help? Ideally, I would like to be able to write something along these lines:
v = <1, 2, 3, 4>
u = <0.3, 0.4, 0.5>
<>
is just a random choice for illustration purpose.