With numpy and python3 I have to following problem:
I have a function which returns a 2 dimensional array of integers of fixed size (2x3 in this case). What is the most idiomatic way to run this function n times and stack these together to a 3 dimensional 2x3xn array? What about performance? Something which only does the minimum number of allocations would be nice.
Something which only does the minimum number of allocations would be nice.- that's C++-style thinking. Allocation isn't what's going to kill your performance in Python. If you try to run this functionntimes instead of taking advantage of NumPy vectorized operations, interpreter overhead is going to kill your performance.