You can use `np.array2string` to do this a bit more cleanly.  See for example f1f6cba222