Hacker News new | past | comments | ask | show | jobs | submit login

I think that is some kind of feature. Numpy tries hard to guarantee efficient access to its ndarrays and this is simpler to implement using fixed arrays and mostly you know your bounds at initialization time anyway.

Btw. you can grow them using hstack and vstack although I am not sure how efficient that is.




Growing with vstack or hstack is very slow. I have seen code where a big csv with time series data is parsed line by line the corresponding numpy array was grown using vstack for each row. worst case: quadratic runtime


That'd be so much faster using a generator and a NumPy.concatenate at the end. Orders of magnitude faster, if we're talking about a large CSV.


There are fixed arrays in Julia too, for those who absolutely must eke out that last 1% gain in performance


It ain't just a 1% gain. Use a Python list if you want to append/pop.


A deque is probably a better option for performance.


Depends on how much it grows. I'd actually expect very little difference for most append/pop situations. A deque is there for appendleft and popleft.


that may be so in Python, but have you checked the performance differences in Julia?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: