Even better. I just had a look at the numpy code and can confirm that `ndarray.resize()` internally uses `realloc()` so it should be the most efficient way to do it.